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:
parent
14e5e175fc
commit
7c38f5811b
1 changed files with 10 additions and 1 deletions
|
@ -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');
|
||||||
|
|
Loading…
Reference in a new issue