From c4913eb518ce779e28bb9ea388bacd2eba8b8eba Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 11 Mar 2024 10:45:08 -0300 Subject: [PATCH] Bug 35967: Add more test cases Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/api/v1/patrons_recalls.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/patrons_recalls.t b/t/db_dependent/api/v1/patrons_recalls.t index 2b7dc046e91..5943af95282 100755 --- a/t/db_dependent/api/v1/patrons_recalls.t +++ b/t/db_dependent/api/v1/patrons_recalls.t @@ -34,7 +34,7 @@ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); subtest 'list() tests' => sub { - plan tests => 9; + plan tests => 15; $schema->storage->txn_begin; @@ -54,10 +54,22 @@ subtest 'list() tests' => sub { my $recall_1 = $builder->build_object( { class => 'Koha::Recalls', value => { patron_id => $patron->id } } ); my $recall_2 = $builder->build_object( { class => 'Koha::Recalls', value => { patron_id => $patron->id } } ); + # Add another patron + my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } ); + my $recall_3 = $builder->build_object( { class => 'Koha::Recalls', value => { patron_id => $patron_2->id } } ); + $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron->id . '/recalls?_order_by=+me.recall_id' ) ->status_is( 200, 'SWAGGER3.2.2' ) ->json_is( '' => [ $recall_1->to_api, $recall_2->to_api ], 'Recalls retrieved' ); + $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id . '/recalls?_order_by=+me.recall_id' ) + ->status_is( 200, 'SWAGGER3.2.2' )->json_is( '' => [ $recall_3->to_api ], 'Recalls retrieved' ); + + $recall_3->delete; + + $t->get_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->id . '/recalls?_order_by=+me.recall_id' ) + ->status_is( 200, 'SWAGGER3.2.2' )->json_is( [] ); + my $non_existent_patron = $builder->build_object( { class => 'Koha::Patrons' } ); my $non_existent_patron_id = $non_existent_patron->id; -- 2.44.0