From aaa22ec3f5a7cb98b3c685c74ffc5e252acbfe14 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 Signed-off-by: Martin Renvoize --- 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 64485f01ac..471a2462f4 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.20.1