Bugzilla – Attachment 161245 Details for
Bug 30230
Search for patrons in checkout should not require edit_borrowers permission
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30230: (QA follow-up) Add unit tests for API definition change
Bug-30230-QA-follow-up-Add-unit-tests-for-API-defi.patch (text/plain), 3.69 KB, created by
Martin Renvoize (ashimema)
on 2024-01-22 14:54:55 UTC
(
hide
)
Description:
Bug 30230: (QA follow-up) Add unit tests for API definition change
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-01-22 14:54:55 UTC
Size:
3.69 KB
patch
obsolete
>From 5d9d633b1bfb7b58738bfc7f924898adbb0510b7 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 22 Jan 2024 14:23:34 +0000 >Subject: [PATCH] Bug 30230: (QA follow-up) Add unit tests for API definition > change > >--- > t/db_dependent/api/v1/patrons.t | 46 ++++++++++++++++++++++++++------- > 1 file changed, 37 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index f882cae0e0e..e48ad3e0f42 100755 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -81,22 +81,36 @@ subtest 'list() tests' => sub { > > subtest 'librarian access tests' => sub { > >- plan tests => 19; >+ plan tests => 21; > > $schema->storage->txn_begin; > > my $librarian = $builder->build_object( > { > class => 'Koha::Patrons', >- value => { flags => 2**4 } # borrowers flag = 4 >+ value => { flags => 0 } # no additional permissions > } > ); > my $password = 'thePassword123'; > $librarian->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $librarian->userid; > >+ $t->get_ok("//$userid:$password@/api/v1/patrons/") >+ ->status_is(403, 'Basic librarian unable to see patrons'); >+ >+ $builder->build( >+ { >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $librarian->borrowernumber, >+ module_bit => 4, >+ code => 'list_borrowers', >+ }, >+ } >+ ); >+ > $t->get_ok("//$userid:$password@/api/v1/patrons") >- ->status_is(200); >+ ->status_is(200, 'list_borrowers makes /patrons accessible'); > > $t->get_ok("//$userid:$password@/api/v1/patrons?cardnumber=" . $librarian->cardnumber) > ->status_is(200) >@@ -237,24 +251,38 @@ subtest 'get() tests' => sub { > $schema->storage->txn_rollback; > > subtest 'librarian access tests' => sub { >- plan tests => 6; >+ plan tests => 8; > > $schema->storage->txn_begin; > >- my $librarian = $builder->build_object( >+ my $basic_librarian = $builder->build_object( > { > class => 'Koha::Patrons', >- value => { flags => 2**4 } # borrowers flag = 4 >+ value => { flags => 0 } # no additional permissions > } > ); > my $password = 'thePassword123'; >- $librarian->set_password( { password => $password, skip_validation => 1 } ); >- my $userid = $librarian->userid; >+ $basic_librarian->set_password( { password => $password, skip_validation => 1 } ); >+ my $userid = $basic_librarian->userid; > > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > > $t->get_ok("//$userid:$password@/api/v1/patrons/" . $patron->id) >- ->status_is(200) >+ ->status_is(403, 'Basic librarian unable to see patrons'); >+ >+ $builder->build( >+ { >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $basic_librarian->borrowernumber, >+ module_bit => 4, >+ code => 'list_borrowers', >+ }, >+ } >+ ); >+ >+ $t->get_ok("//$userid:$password@/api/v1/patrons/" . $patron->id) >+ ->status_is(200, 'list_borrowers permission makes patron visible') > ->json_is('/patron_id' => $patron->id) > ->json_is('/category_id' => $patron->categorycode ) > ->json_is('/surname' => $patron->surname) >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30230
:
159409
|
159412
|
159427
|
159517
|
159559
|
159613
|
159633
|
159654
|
159667
|
159668
|
159933
|
159988
|
159989
|
159990
|
159991
|
159992
|
161068
|
161240
|
161241
|
161242
|
161243
|
161245
|
161246
|
161250
|
161251