View | Details | Raw Unified | Return to bug 36482
Collapse All | Expand All

(-)a/t/db_dependent/api/v1/libraries.t (-2 / +14 lines)
Lines 111-117 subtest 'list() tests' => sub { Link Here
111
111
112
subtest 'get() tests' => sub {
112
subtest 'get() tests' => sub {
113
113
114
    plan tests => 6;
114
    plan tests => 12;
115
115
116
    $schema->storage->txn_begin;
116
    $schema->storage->txn_begin;
117
117
Lines 128-133 subtest 'get() tests' => sub { Link Here
128
      ->status_is( 200, 'SWAGGER3.2.2' )
128
      ->status_is( 200, 'SWAGGER3.2.2' )
129
      ->json_is( '' => $library->to_api, 'SWAGGER3.3.2' );
129
      ->json_is( '' => $library->to_api, 'SWAGGER3.3.2' );
130
130
131
    $t->get_ok( "//$userid:$password@/api/v1/libraries/"
132
            . $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } )->status_is(200)
133
        ->json_is( { %{ $library->to_api }, desks => [], cash_registers => [] } );
134
135
    my $desk = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } );
136
    my $cash_register =
137
        $builder->build_object( { class => 'Koha::Cash::Registers', value => { branch => $library->id } } );
138
139
    $t->get_ok( "//$userid:$password@/api/v1/libraries/"
140
            . $library->branchcode => { 'x-koha-embed' => 'cash_registers,desks' } )->status_is(200)
141
        ->json_is(
142
        { %{ $library->to_api }, desks => [ $desk->to_api ], cash_registers => [ $cash_register->to_api ] } );
143
131
    my $non_existent_code = $library->branchcode;
144
    my $non_existent_code = $library->branchcode;
132
    $library->delete;
145
    $library->delete;
133
146
134
- 

Return to bug 36482