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

(-)a/t/db_dependent/api/v1/biblios.t (-6 / +12 lines)
Lines 210-222 subtest 'get_items() tests' => sub { Link Here
210
            {
210
            {
211
                class => 'Koha::Patrons',
211
                class => 'Koha::Patrons',
212
                value => {
212
                value => {
213
                    flags        => 1,
213
                    flags => 1,
214
                }
214
                }
215
            }
215
            }
216
        );
216
        );
217
        $patron->set_password( { password => $password, skip_validation => 1 } );
217
        $patron->set_password( { password => $password, skip_validation => 1 } );
218
        my $userid         = $patron->userid;
218
        my $userid = $patron->userid;
219
        my $pickup_library = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
219
        my $pickup_library =
220
            $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
220
221
221
        my $item = $builder->build_sample_item;
222
        my $item = $builder->build_sample_item;
222
        my $data = {
223
        my $data = {
Lines 224-237 subtest 'get_items() tests' => sub { Link Here
224
            biblio_id         => $item->biblionumber,
225
            biblio_id         => $item->biblionumber,
225
            item_id           => $item->itemnumber,
226
            item_id           => $item->itemnumber,
226
            pickup_library_id => $pickup_library->branchcode,
227
            pickup_library_id => $pickup_library->branchcode,
227
            expiration_date   => output_pref( { dt => DateTime->now->add(days => "3")->truncate(to => 'day'), dateformat => 'iso', dateonly => 1 } ),
228
            expiration_date   => output_pref(
229
                {
230
                    dt       => dt_from_string()->add( days => "3" )->truncate( to => 'day' ), dateformat => 'iso',
231
                    dateonly => 1
232
                }
233
            ),
228
        };
234
        };
229
        $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $data )->status_is(201)->json_has('/hold_id');
235
        $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $data )->status_is(201)->json_has('/hold_id');
230
236
231
        $t->get_ok( "//$userid:$password@/api/v1/biblios/"
237
        $t->get_ok( "//$userid:$password@/api/v1/biblios/"
232
                . $item->biblionumber
238
                . $item->biblionumber
233
                . "/items" => { "x-koha-embed" => "first_hold+strings" } )->status_is(200)
239
                . "/items" => { "x-koha-embed" => "first_hold+strings" } )->status_is(200)
234
            ->json_is( '/0/first_hold/_strings/pickup_library_id' => { type => 'library', str => $pickup_library->branchname } );
240
            ->json_is(
241
            '/0/first_hold/_strings/pickup_library_id' => { type => 'library', str => $pickup_library->branchname } );
235
    };
242
    };
236
243
237
    $schema->storage->txn_rollback;
244
    $schema->storage->txn_rollback;
238
- 

Return to bug 36535