Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 14; |
20 |
use Test::More tests => 15; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Mojo; |
22 |
use Test::Mojo; |
23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
Lines 1547-1549
subtest 'delete() tests' => sub {
Link Here
|
1547 |
|
1547 |
|
1548 |
$schema->storage->txn_rollback; |
1548 |
$schema->storage->txn_rollback; |
1549 |
}; |
1549 |
}; |
1550 |
- |
1550 |
|
|
|
1551 |
subtest 'PUT /holds/{hold_id}/toggle_lowest_priority tests' => sub { |
1552 |
|
1553 |
plan tests => 5; |
1554 |
|
1555 |
$schema->storage->txn_begin; |
1556 |
|
1557 |
my $password = 'AbcdEFG123'; |
1558 |
|
1559 |
my $library_1 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); |
1560 |
|
1561 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); |
1562 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
1563 |
my $userid = $patron->userid; |
1564 |
$builder->build( |
1565 |
{ |
1566 |
source => 'UserPermission', |
1567 |
value => { |
1568 |
borrowernumber => $patron->borrowernumber, |
1569 |
module_bit => 6, |
1570 |
code => 'modify_holds_priority', |
1571 |
}, |
1572 |
} |
1573 |
); |
1574 |
|
1575 |
# Disable logging |
1576 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
1577 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
1578 |
|
1579 |
my $biblio = $builder->build_sample_biblio; |
1580 |
|
1581 |
# biblio-level hold |
1582 |
my $hold = Koha::Holds->find( |
1583 |
AddReserve( |
1584 |
{ |
1585 |
branchcode => $library_1->branchcode, |
1586 |
borrowernumber => $patron->borrowernumber, |
1587 |
biblionumber => $biblio->biblionumber, |
1588 |
priority => 1, |
1589 |
itemnumber => undef, |
1590 |
} |
1591 |
) |
1592 |
); |
1593 |
|
1594 |
$t->put_ok( "//$userid:$password@/api/v1/holds/0" . "/toggle_lowest_priority" )->status_is(404); |
1595 |
|
1596 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/toggle_lowest_priority" )->status_is(200); |
1597 |
|
1598 |
is( $hold->discard_changes->lowest_priority, 1, 'Priority set to lowest' ); |
1599 |
|
1600 |
$schema->storage->txn_rollback; |
1601 |
}; |