@@ -, +, @@ --- t/db_dependent/api/v1/patrons_recalls.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/t/db_dependent/api/v1/patrons_recalls.t +++ a/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; --