Bug 38322: Adjust tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0e899b8882)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-11-01 12:54:09 +00:00 committed by Lucas Gass
parent 650ef902d4
commit 1c2f7e2708
1 changed files with 13 additions and 2 deletions

View File

@ -35,7 +35,7 @@ t::lib::Mocks::mock_preference( 'ChildNeedsGuarantor', 0 );
subtest 'list() tests' => sub {
plan tests => 11;
plan tests => 14;
$schema->storage->txn_begin;
@ -70,10 +70,21 @@ subtest 'list() tests' => sub {
}
);
# Two erm_users created, they should both be returned
# Two erm_users created, onyl self is returned without permission to view_any_borrower
$t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200)
->json_is( [ $librarian->to_api( { user => $librarian } ) ] );
my $dbh = C4::Context->dbh;
$dbh->do(
q{INSERT INTO user_permissions( borrowernumber, module_bit, code ) VALUES (?, ?, ?)}, undef,
( $librarian->borrowernumber, 4, 'view_borrower_infos_from_any_libraries' )
);
# Two erm_users created, they should both be returned
$t->get_ok("//$userid:$password@/api/v1/erm/users")->status_is(200)
->json_is(
[ $librarian->to_api( { user => $librarian } ), $another_erm_user->to_api( { user => $another_erm_user } ) ] );
# Warn on unsupported query parameter
$t->get_ok("//$userid:$password@/api/v1/erm/users?blah=blah")
->status_is(400)