Bug 33103: Add REST API tests

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-03-02 14:08:29 +01:00 committed by Tomas Cohen Arazi
parent 14e5e175fc
commit 7c38f5811b
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -36,7 +36,7 @@ my $t = Test::Mojo->new('Koha::REST::V1');
subtest 'list() and delete() tests | authorized user' => sub { subtest 'list() and delete() tests | authorized user' => sub {
plan tests => 35; plan tests => 40;
$schema->storage->txn_begin; $schema->storage->txn_begin;
@ -91,6 +91,15 @@ subtest 'list() and delete() tests | authorized user' => sub {
->status_is(200) ->status_is(200)
->json_like( '/0/name' => qr/Amerindia/ ); ->json_like( '/0/name' => qr/Amerindia/ );
my @aliases = ( { alias => 'alias 1' }, { alias => 'alias 2' } );
$vendor->aliases( \@aliases );
$t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors" =>
{ 'x-koha-embed' => 'aliases' } )
->status_is(200)
->json_has('/0/aliases', 'aliases are embeded')
->json_is('/0/aliases/0/alias' => 'alias 1', 'alias 1 is embeded')
->json_is('/0/aliases/1/alias' => 'alias 2', 'alias 2 is embeded');
$t->delete_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id ) $t->delete_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )
->status_is(204, 'SWAGGER3.2.4') ->status_is(204, 'SWAGGER3.2.4')
->content_is('', 'SWAGGER3.3.4'); ->content_is('', 'SWAGGER3.3.4');