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

(-)a/t/db_dependent/api/v1/libraries.t (-6 / +8 lines)
Lines 24-29 use Test::Warn; Link Here
24
use t::lib::TestBuilder;
24
use t::lib::TestBuilder;
25
use t::lib::Mocks;
25
use t::lib::Mocks;
26
26
27
use List::Util qw(min);
28
27
use Koha::Libraries;
29
use Koha::Libraries;
28
use Koha::Database;
30
use Koha::Database;
29
31
Lines 35-41 t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); Link Here
35
my $t = Test::Mojo->new('Koha::REST::V1');
37
my $t = Test::Mojo->new('Koha::REST::V1');
36
38
37
subtest 'list() tests' => sub {
39
subtest 'list() tests' => sub {
38
    plan tests => 8;
40
    plan tests => 7;
39
41
40
    $schema->storage->txn_begin;
42
    $schema->storage->txn_begin;
41
43
Lines 54-65 subtest 'list() tests' => sub { Link Here
54
    $another_library = $builder->build_object({ class => 'Koha::Libraries', value => $another_library });
56
    $another_library = $builder->build_object({ class => 'Koha::Libraries', value => $another_library });
55
57
56
    ## Authorized user tests
58
    ## Authorized user tests
57
    my $count_of_libraries = Koha::Libraries->search->count;
58
    # Make sure we are returned with the correct amount of libraries
59
    # Make sure we are returned with the correct amount of libraries
59
    $t->get_ok( "//$userid:$password@/api/v1/libraries" )
60
    $t->get_ok( "//$userid:$password@/api/v1/libraries" )
60
      ->status_is( 200, 'SWAGGER3.2.2' )
61
      ->status_is( 200, 'SWAGGER3.2.2' );
61
      ->json_has('/'.($count_of_libraries-1).'/library_id')
62
62
      ->json_hasnt('/'.($count_of_libraries).'/library_id');
63
    my $response_count = scalar @{ $t->tx->res->json };
64
    my $expected_count = min( Koha::Libraries->count, C4::Context->preference('RESTdefaultPageSize') );
65
    is( $response_count, $expected_count, 'Results count is paginated');
63
66
64
    subtest 'query parameters' => sub {
67
    subtest 'query parameters' => sub {
65
68
66
- 

Return to bug 25570