Lines 24-29
use t::lib::TestBuilder;
Link Here
|
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
25 |
|
25 |
|
26 |
use DateTime; |
26 |
use DateTime; |
|
|
27 |
use Mojo::JSON qw(encode_json); |
27 |
|
28 |
|
28 |
use C4::Context; |
29 |
use C4::Context; |
29 |
use Koha::Patrons; |
30 |
use Koha::Patrons; |
Lines 355-369
subtest 'test AllowHoldDateInFuture' => sub {
Link Here
|
355 |
|
356 |
|
356 |
subtest 'test AllowHoldPolicyOverride' => sub { |
357 |
subtest 'test AllowHoldPolicyOverride' => sub { |
357 |
|
358 |
|
358 |
plan tests => 5; |
359 |
plan tests => 7; |
359 |
|
360 |
|
360 |
$dbh->do('DELETE FROM reserves'); |
361 |
$dbh->do('DELETE FROM reserves'); |
361 |
|
362 |
|
362 |
Koha::CirculationRules->set_rules( |
363 |
Koha::CirculationRules->set_rules( |
363 |
{ |
364 |
{ |
364 |
itemtype => undef, |
365 |
itemtype => undef, |
365 |
branchcode => undef, |
366 |
branchcode => undef, |
366 |
rules => { |
367 |
rules => { |
367 |
holdallowed => 1 |
368 |
holdallowed => 1 |
368 |
} |
369 |
} |
369 |
} |
370 |
} |
Lines 384-390
subtest 'test AllowHoldPolicyOverride' => sub {
Link Here
|
384 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); |
385 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); |
385 |
|
386 |
|
386 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
387 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
387 |
->status_is(201); |
388 |
->status_is(403); |
|
|
389 |
|
390 |
$t->post_ok( |
391 |
"//$userid_3:$password@/api/v1/holds" => { |
392 |
'x-koha-override' => |
393 |
encode_json( { AllowHoldPolicyOverride => Mojo::JSON->true } ) |
394 |
} => json => $post_data |
395 |
)->status_is(201); |
388 |
}; |
396 |
}; |
389 |
|
397 |
|
390 |
$schema->storage->txn_rollback; |
398 |
$schema->storage->txn_rollback; |
391 |
- |
|
|