From 004c63ead26656a5bbc37a50971c99b3c5342497 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 6 Jan 2022 09:27:28 -0300 Subject: [PATCH] Bug 29806: Regression tests Signed-off-by: David Nind --- t/db_dependent/api/v1/holds.t | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t index 006c61659a..abf23d4fca 100755 --- a/t/db_dependent/api/v1/holds.t +++ b/t/db_dependent/api/v1/holds.t @@ -1066,7 +1066,7 @@ subtest 'edit() tests' => sub { subtest 'add() tests' => sub { - plan tests => 10; + plan tests => 16; $schema->storage->txn_begin; @@ -1185,6 +1185,24 @@ subtest 'add() tests' => sub { $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data ) ->status_is(201); + # empty cases + $mock_biblio->mock( 'pickup_locations', sub { + return Koha::Libraries->new->empty; + }); + + $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) + ->status_is(400) + ->json_is({ error => 'The supplied pickup location is not valid' }); + + # empty cases + $mock_item->mock( 'pickup_locations', sub { + return Koha::Libraries->new->empty; + }); + + $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data ) + ->status_is(400) + ->json_is({ error => 'The supplied pickup location is not valid' }); + $schema->storage->txn_rollback; }; -- 2.30.2