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:
parent
a5d4f6d51e
commit
d0268bb6e3
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue