Bug 29877: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8ea1b883b7)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 998e0997e4)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Tomas Cohen Arazi 2022-01-13 12:10:24 -03:00 committed by Victor Grousset/tuxayo
parent b5bcdaf2cb
commit 2fa43197c1
1 changed files with 15 additions and 1 deletions

View File

@ -596,7 +596,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;
@ -682,6 +682,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;
};