Bug 28254: Unit tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
de25586ba0
commit
e3baa979cf
|
|
@ -1136,7 +1136,7 @@ subtest 'add() tests' => sub {
|
|||
|
||||
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
|
||||
|
||||
plan tests => 16;
|
||||
plan tests => 20;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
|
|
@ -1240,6 +1240,21 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
|
|||
|
||||
is( $hold->discard_changes->branchcode->branchcode, $library_1->branchcode, 'pickup library unchanged' );
|
||||
|
||||
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 );
|
||||
|
||||
# Attempt to use an invalid pickup locations with override succeeds
|
||||
$t->put_ok( "//$userid:$password@/api/v1/holds/"
|
||||
. $hold->id
|
||||
. "/pickup_location"
|
||||
=> { 'x-koha-override' => 'any' }
|
||||
=> json => { pickup_library_id => $library_2->branchcode } )
|
||||
->status_is(200)
|
||||
->json_is({ pickup_library_id => $library_2->branchcode });
|
||||
|
||||
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library changed' );
|
||||
|
||||
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0 );
|
||||
|
||||
$libraries_query = {
|
||||
branchcode => {
|
||||
'-in' => [ $library_1->branchcode, $library_2->branchcode ]
|
||||
|
|
|
|||
Loading…
Reference in New Issue