From 8b2e6bcf26fe5f3d76133b82099307cc3b576c8c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 12 Dec 2023 16:52:14 +0000 Subject: [PATCH] Bug 35468: (follow-up) Test only the specific permission needed The tests were granting circulation top-level permissions - we should be able to perform the actions with only 'manage_bookings'. This patch updates the tests to use the narrower permission. Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/api/v1/bookings.t | 36 +++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/api/v1/bookings.t b/t/db_dependent/api/v1/bookings.t index e5eb75120e6..bbaff2ee863 100755 --- a/t/db_dependent/api/v1/bookings.t +++ b/t/db_dependent/api/v1/bookings.t @@ -194,7 +194,17 @@ subtest 'add() tests' => sub { my $librarian = $builder->build_object( { class => 'Koha::Patrons', - value => { flags => 2**1 } # circulate flag = 1 + value => { flags => 0 } # no additional permissions + } + ); + $builder->build( + { + source => 'UserPermission', + value => { + borrowernumber => $librarian->borrowernumber, + module_bit => 1, + code => 'manage_bookings', + }, } ); my $password = 'thePassword123'; @@ -273,7 +283,17 @@ subtest 'update() tests' => sub { my $librarian = $builder->build_object( { class => 'Koha::Patrons', - value => { flags => 2**1 } # circulate flag = 1 + value => { flags => 0 } # no additional permissions + } + ); + $builder->build( + { + source => 'UserPermission', + value => { + borrowernumber => $librarian->borrowernumber, + module_bit => 1, + code => 'manage_bookings', + }, } ); my $password = 'thePassword123'; @@ -371,7 +391,17 @@ subtest 'delete() tests' => sub { my $librarian = $builder->build_object( { class => 'Koha::Patrons', - value => { flags => 2**1 } # circulate flag = 1 + value => { flags => 0 } # no additional permissions + } + ); + $builder->build( + { + source => 'UserPermission', + value => { + borrowernumber => $librarian->borrowernumber, + module_bit => 1, + code => 'manage_bookings', + }, } ); my $password = 'thePassword123'; -- 2.43.0