Bug 32240: Prevent erm_users.t to fail if checkout exist

We should not (never) remove all patrons before tests

Test plan:
0. Don't apply the patch
1. Check an item out
2. Run the tests
=> Fail
3. Apply the patch
4. Create a patron with the erm permission
5. Run the tests
=> Must return green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-11-17 09:51:42 +01:00 committed by Tomas Cohen Arazi
parent 1d176ae10a
commit 32aceb32d4
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -38,7 +38,8 @@ subtest 'list() tests' => sub {
$schema->storage->txn_begin;
Koha::Patrons->search->delete;
Koha::Patrons->search->update( { flags => 0 } );
$schema->resultset('UserPermission')->delete;
my $librarian = $builder->build_object(
{
@ -51,8 +52,6 @@ subtest 'list() tests' => sub {
$librarian->set_password( { password => $password, skip_validation => 1 } );
my $userid = $librarian->userid;
## Authorized user tests
# One erm_user created, should get returned
$librarian->discard_changes;
@ -85,6 +84,7 @@ subtest 'list() tests' => sub {
$patron->set_password( { password => $password, skip_validation => 1 } );
my $unauth_userid = $patron->userid;
# Unauthorized access
$t->get_ok("//$unauth_userid:$password@/api/v1/erm/users")->status_is(403);