Bug 36482: Add embed tests
prove t/db_dependent/api/v1/libraries.t
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 39879cd5cf
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
0e2fd5217e
commit
c2f66eb757
1 changed files with 14 additions and 1 deletions
|
@ -111,7 +111,7 @@ subtest 'list() tests' => sub {
|
|||
|
||||
subtest 'get() tests' => sub {
|
||||
|
||||
plan tests => 6;
|
||||
plan tests => 12;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
|
@ -128,6 +128,19 @@ subtest 'get() tests' => sub {
|
|||
->status_is( 200, 'SWAGGER3.2.2' )
|
||||
->json_is( '' => $library->to_api, 'SWAGGER3.3.2' );
|
||||
|
||||
$t->get_ok( "//$userid:$password@/api/v1/libraries/"
|
||||
. $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } )->status_is(200)
|
||||
->json_is( { %{ $library->to_api }, desks => [], cash_registers => [] } );
|
||||
|
||||
my $desk = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } );
|
||||
my $cash_register =
|
||||
$builder->build_object( { class => 'Koha::Cash::Registers', value => { branch => $library->id } } );
|
||||
|
||||
$t->get_ok( "//$userid:$password@/api/v1/libraries/"
|
||||
. $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } )->status_is(200)
|
||||
->json_is(
|
||||
{ %{ $library->to_api }, desks => [ $desk->to_api ], cash_registers => [ $cash_register->to_api ] } );
|
||||
|
||||
my $non_existent_code = $library->branchcode;
|
||||
$library->delete;
|
||||
|
||||
|
|
Loading…
Reference in a new issue