From 7d101ac12f56e5b7e0ace9f333b8f4c0585e673a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 17 Nov 2022 09:51:42 +0100 Subject: [PATCH] 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 --- t/db_dependent/api/v1/erm_users.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/api/v1/erm_users.t b/t/db_dependent/api/v1/erm_users.t index 1e2ac643796..fff58cbe9dd 100755 --- a/t/db_dependent/api/v1/erm_users.t +++ b/t/db_dependent/api/v1/erm_users.t @@ -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); -- 2.25.1