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 1575-1577
subtest 'delete() tests' => sub {
Link Here
|
1575 |
|
1575 |
|
1576 |
$schema->storage->txn_rollback; |
1576 |
$schema->storage->txn_rollback; |
1577 |
}; |
1577 |
}; |
1578 |
- |
1578 |
|
|
|
1579 |
subtest 'PUT /holds/{hold_id}/lowest_priority tests' => sub { |
1580 |
|
1581 |
plan tests => 5; |
1582 |
|
1583 |
$schema->storage->txn_begin; |
1584 |
|
1585 |
my $password = 'AbcdEFG123'; |
1586 |
|
1587 |
my $library_1 = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } ); |
1588 |
|
1589 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); |
1590 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
1591 |
my $userid = $patron->userid; |
1592 |
$builder->build( |
1593 |
{ |
1594 |
source => 'UserPermission', |
1595 |
value => { |
1596 |
borrowernumber => $patron->borrowernumber, |
1597 |
module_bit => 6, |
1598 |
code => 'modify_holds_priority', |
1599 |
}, |
1600 |
} |
1601 |
); |
1602 |
|
1603 |
# Disable logging |
1604 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
1605 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
1606 |
|
1607 |
my $biblio = $builder->build_sample_biblio; |
1608 |
|
1609 |
# biblio-level hold |
1610 |
my $hold = Koha::Holds->find( |
1611 |
AddReserve( |
1612 |
{ |
1613 |
branchcode => $library_1->branchcode, |
1614 |
borrowernumber => $patron->borrowernumber, |
1615 |
biblionumber => $biblio->biblionumber, |
1616 |
priority => 1, |
1617 |
itemnumber => undef, |
1618 |
} |
1619 |
) |
1620 |
); |
1621 |
|
1622 |
$t->put_ok( "//$userid:$password@/api/v1/holds/0" . "/lowest_priority" )->status_is(404); |
1623 |
|
1624 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/lowest_priority" )->status_is(200); |
1625 |
|
1626 |
is( $hold->discard_changes->lowestPriority, 1, 'Priority set to lowest' ); |
1627 |
|
1628 |
$schema->storage->txn_rollback; |
1629 |
}; |