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 => 8; |
361 |
plan tests => 12; |
362 |
|
362 |
|
363 |
$schema->storage->txn_begin; |
363 |
$schema->storage->txn_begin; |
364 |
|
364 |
|
Lines 407-412
subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub {
Link Here
|
407 |
->status_is(403) |
407 |
->status_is(403) |
408 |
->json_is( '/error' => "Hold cannot be placed. Reason: ageRestricted" ); |
408 |
->json_is( '/error' => "Hold cannot be placed. Reason: ageRestricted" ); |
409 |
|
409 |
|
|
|
410 |
# x-koha-override doesn't override if AllowHoldPolicyOverride not set |
411 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => |
412 |
{ 'x-koha-override' => 'any' } => json => $post_data ) |
413 |
->status_is(403); |
414 |
|
410 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); |
415 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); |
411 |
|
416 |
|
412 |
$can_item_be_reserved_result = { status => 'pickupNotInHoldGroup' }; |
417 |
$can_item_be_reserved_result = { status => 'pickupNotInHoldGroup' }; |
Lines 416-423
subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub {
Link Here
|
416 |
->json_is( |
421 |
->json_is( |
417 |
'/error' => "Hold cannot be placed. Reason: pickupNotInHoldGroup" ); |
422 |
'/error' => "Hold cannot be placed. Reason: pickupNotInHoldGroup" ); |
418 |
|
423 |
|
|
|
424 |
# x-koha-override overrides the status |
425 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => |
426 |
{ 'x-koha-override' => 'any' } => json => $post_data ) |
427 |
->status_is(201); |
428 |
|
419 |
$can_item_be_reserved_result = { status => 'OK' }; |
429 |
$can_item_be_reserved_result = { status => 'OK' }; |
420 |
|
430 |
|
|
|
431 |
# x-koha-override works when status not need override |
421 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => |
432 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => |
422 |
{ 'x-koha-override' => 'any' } => json => $post_data ) |
433 |
{ 'x-koha-override' => 'any' } => json => $post_data ) |
423 |
->status_is(201); |
434 |
->status_is(201); |
424 |
- |
|
|