Lines 51-56
subtest 'list() tests' => sub {
Link Here
|
51 |
} |
51 |
} |
52 |
); |
52 |
); |
53 |
|
53 |
|
|
|
54 |
# Make sure we have at least 10 items |
55 |
for ( 1..10 ) { |
56 |
$builder->build_object({ class => 'Koha::Items' }); |
57 |
} |
58 |
|
54 |
my $nonprivilegedpatron = $builder->build_object( |
59 |
my $nonprivilegedpatron = $builder->build_object( |
55 |
{ |
60 |
{ |
56 |
class => 'Koha::Patrons', |
61 |
class => 'Koha::Patrons', |
Lines 72-84
subtest 'list() tests' => sub {
Link Here
|
72 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
77 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
73 |
$userid = $patron->userid; |
78 |
$userid = $patron->userid; |
74 |
|
79 |
|
75 |
$t->get_ok( "//$userid:$password@/api/v1/items" ) |
80 |
$t->get_ok( "//$userid:$password@/api/v1/items?_per_page=10" ) |
76 |
->status_is( 200, 'SWAGGER3.2.2' ); |
81 |
->status_is( 200, 'SWAGGER3.2.2' ); |
77 |
|
82 |
|
78 |
my $items_count = Koha::Items->search->count; |
|
|
79 |
my $response_count = scalar @{ $t->tx->res->json }; |
83 |
my $response_count = scalar @{ $t->tx->res->json }; |
80 |
|
84 |
|
81 |
is( $items_count, $response_count, 'The API returns all the items' ); |
85 |
is( $response_count, 10, 'The API returns 10 items' ); |
82 |
|
86 |
|
83 |
$t->get_ok( "//$userid:$password@/api/v1/items?external_id=" . $item->barcode ) |
87 |
$t->get_ok( "//$userid:$password@/api/v1/items?external_id=" . $item->barcode ) |
84 |
->status_is(200) |
88 |
->status_is(200) |
85 |
- |
|
|