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

(-)a/t/db_dependent/api/v1/erm_users.t (-3 / +13 lines)
Lines 35-41 t::lib::Mocks::mock_preference( 'ChildNeedsGuarantor', 0 ); Link Here
35
35
36
subtest 'list() tests' => sub {
36
subtest 'list() tests' => sub {
37
37
38
    plan tests => 11;
38
    plan tests => 14;
39
39
40
    $schema->storage->txn_begin;
40
    $schema->storage->txn_begin;
41
41
Lines 70-79 subtest 'list() tests' => sub { Link Here
70
        }
70
        }
71
    );
71
    );
72
72
73
    # Two erm_users created, they should both be returned
73
    # Two erm_users created, onyl self is returned without permission to view_any_borrower
74
    $t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200)
74
    $t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200)
75
        ->json_is( [ $librarian->to_api( { user => $librarian } ) ] );
75
        ->json_is( [ $librarian->to_api( { user => $librarian } ) ] );
76
76
77
    my $dbh = C4::Context->dbh;
78
    $dbh->do(
79
        q{INSERT INTO user_permissions( borrowernumber, module_bit, code ) VALUES (?, ?, ?)}, undef,
80
        ( $librarian->borrowernumber, 4, 'view_borrower_infos_from_any_libraries' )
81
    );
82
83
    # Two erm_users created, they should both be returned
84
    $t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200)
85
        ->json_is(
86
        [ $librarian->to_api( { user => $librarian } ), $another_erm_user->to_api( { user => $another_erm_user } ) ] );
87
77
    # Warn on unsupported query parameter
88
    # Warn on unsupported query parameter
78
    $t->get_ok("//$userid:$password@/api/v1/erm/users?blah=blah")
89
    $t->get_ok("//$userid:$password@/api/v1/erm/users?blah=blah")
79
      ->status_is(400)
90
      ->status_is(400)
80
- 

Return to bug 38322