From 855cbdd7037bbe2a94099a27d57f5a77d414cab7 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 13 Jan 2022 12:10:24 -0300 Subject: [PATCH] Bug 29877: Regression tests Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Fuerste-Henry --- t/db_dependent/api/v1/holds.t | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t index 006c61659a..fc24aca588 100755 --- a/t/db_dependent/api/v1/holds.t +++ b/t/db_dependent/api/v1/holds.t @@ -651,7 +651,7 @@ subtest 'PUT /holds/{hold_id}/priority tests' => sub { subtest 'add() tests (maxreserves behaviour)' => sub { - plan tests => 7; + plan tests => 11; $schema->storage->txn_begin; @@ -737,6 +737,20 @@ subtest 'add() tests (maxreserves behaviour)' => sub { ->status_is(403) ->json_is( { error => 'Hold cannot be placed. Reason: tooManyReserves' } ); + t::lib::Mocks::mock_preference( 'maxreserves', 0 ); + + $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data ) + ->status_is(201, 'maxreserves == 0 => no limit'); + + # cleanup for the next tests + my $hold_id = $t->tx->res->json->{hold_id}; + Koha::Holds->find( $hold_id )->delete; + + t::lib::Mocks::mock_preference( 'maxreserves', undef ); + + $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data ) + ->status_is(201, 'maxreserves == undef => no limit'); + $schema->storage->txn_rollback; }; -- 2.30.2