Bug 35967: Add more test cases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b1aa99e96d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomas Cohen Arazi 2024-03-11 10:45:08 -03:00 committed by Fridolin Somers
parent a5d4f6d51e
commit d0268bb6e3
1 changed files with 13 additions and 1 deletions

View File

@ -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;