Lines 358-364
$schema->storage->txn_rollback;
Link Here
|
358 |
|
358 |
|
359 |
subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { |
359 |
subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { |
360 |
|
360 |
|
361 |
plan tests => 16; |
361 |
plan tests => 18; |
362 |
|
362 |
|
363 |
$schema->storage->txn_begin; |
363 |
$schema->storage->txn_begin; |
364 |
|
364 |
|
Lines 445-450
subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub {
Link Here
|
445 |
{ 'x-koha-override' => 'any' } => json => $post_data ) |
445 |
{ 'x-koha-override' => 'any' } => json => $post_data ) |
446 |
->status_is(201); |
446 |
->status_is(201); |
447 |
|
447 |
|
|
|
448 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0); |
449 |
|
450 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => |
451 |
{ 'x-koha-override' => 'any' } => json => $post_data ) |
452 |
->status_is(400); |
453 |
|
448 |
$schema->storage->txn_rollback; |
454 |
$schema->storage->txn_rollback; |
449 |
}; |
455 |
}; |
450 |
|
456 |
|
Lines 1136-1142
subtest 'add() tests' => sub {
Link Here
|
1136 |
|
1142 |
|
1137 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
1143 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
1138 |
|
1144 |
|
1139 |
plan tests => 20; |
1145 |
plan tests => 28; |
1140 |
|
1146 |
|
1141 |
$schema->storage->txn_begin; |
1147 |
$schema->storage->txn_begin; |
1142 |
|
1148 |
|
Lines 1251-1255
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
Link Here
|
1251 |
|
1257 |
|
1252 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); |
1258 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); |
1253 |
|
1259 |
|
|
|
1260 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1261 |
. $hold->id |
1262 |
. "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } ) |
1263 |
->status_is(400) |
1264 |
->json_is({ error => '[The supplied pickup location is not valid]' }); |
1265 |
|
1266 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used' ); |
1267 |
|
1268 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1269 |
. $hold->id |
1270 |
. "/pickup_location" |
1271 |
=> { 'x-koha-override' => 'any' } |
1272 |
=> json => { pickup_library_id => $library_3->branchcode } ) |
1273 |
->status_is(400) |
1274 |
->json_is({ error => '[The supplied pickup location is not valid]' }); |
1275 |
|
1276 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used, even if x-koha-override is passed' ); |
1277 |
|
1254 |
$schema->storage->txn_rollback; |
1278 |
$schema->storage->txn_rollback; |
1255 |
}; |
1279 |
}; |
1256 |
- |
|
|