From 3bfd79fc861b58611866d8c7143ae8fdd5399edc Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 10 Aug 2020 17:30:13 -0300 Subject: [PATCH] Bug 26181: Regression tests Content-Type: text/plain; charset=utf-8 Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Marcel de Rooy --- t/db_dependent/api/v1/holds.t | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t index 7045c2f849..41cf559ca9 100755 --- a/t/db_dependent/api/v1/holds.t +++ b/t/db_dependent/api/v1/holds.t @@ -24,6 +24,7 @@ use t::lib::TestBuilder; use t::lib::Mocks; use DateTime; +use Mojo::JSON qw(encode_json); use C4::Context; use Koha::Patrons; @@ -355,15 +356,15 @@ subtest 'test AllowHoldDateInFuture' => sub { subtest 'test AllowHoldPolicyOverride' => sub { - plan tests => 5; + plan tests => 7; $dbh->do('DELETE FROM reserves'); Koha::CirculationRules->set_rules( { - itemtype => undef, - branchcode => undef, - rules => { + itemtype => undef, + branchcode => undef, + rules => { holdallowed => 1 } } @@ -384,7 +385,14 @@ subtest 'test AllowHoldPolicyOverride' => sub { t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) - ->status_is(201); + ->status_is(403); + + $t->post_ok( + "//$userid_3:$password@/api/v1/holds" => { + 'x-koha-override' => + encode_json( { AllowHoldPolicyOverride => Mojo::JSON->true } ) + } => json => $post_data + )->status_is(201); }; $schema->storage->txn_rollback; -- 2.11.0