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