Bugzilla – Attachment 136031 Details for
Bug 30780
Librarians with only "place_holds" permissions can not update holds data via REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30780: Regression tests
Bug-30780-Regression-tests.patch (text/plain), 3.26 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-06-13 14:49:48 UTC
(
hide
)
Description:
Bug 30780: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-06-13 14:49:48 UTC
Size:
3.26 KB
patch
obsolete
>From ccfedaa5d9039decb5cf61264621d360e75b94ac Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 13 Jun 2022 11:46:20 -0300 >Subject: [PATCH] Bug 30780: Regression tests > >This patch lowers the used permissions on the suspend/resume tests, and >adds tests for fine-grained permissions on cancelling a hold. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/holds.t | 70 ++++++++++++++++++++++++++++++++++- > 1 file changed, 68 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index 471a2462f4..6665b55116 100755 >--- a/t/db_dependent/api/v1/holds.t >+++ b/t/db_dependent/api/v1/holds.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 13; >+use Test::More tests => 14; > use Test::MockModule; > use Test::Mojo; > use t::lib::TestBuilder; >@@ -461,7 +461,18 @@ subtest 'suspend and resume tests' => sub { > my $password = 'AbcdEFG123'; > > my $patron = $builder->build_object( >- { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 1 } } ); >+ { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 0 } } ); >+ $builder->build( >+ { >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $patron->borrowernumber, >+ module_bit => 6, >+ code => 'place_holds', >+ }, >+ } >+ ); >+ > $patron->set_password({ password => $password, skip_validation => 1 }); > my $userid = $patron->userid; > >@@ -1363,3 +1374,58 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'delete() tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $password = 'AbcdEFG123'; >+ my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0 } }); >+ $patron->set_password({ password => $password, skip_validation => 1 }); >+ my $userid = $patron->userid; >+ >+ # Only have 'place_holds' subpermission >+ $builder->build( >+ { >+ source => 'UserPermission', >+ value => { >+ borrowernumber => $patron->borrowernumber, >+ module_bit => 6, >+ code => 'place_holds', >+ }, >+ } >+ ); >+ >+ # Disable logging >+ t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); >+ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio->biblionumber, >+ library => $patron->branchcode >+ } >+ ); >+ >+ # Add a hold >+ my $hold = Koha::Holds->find( >+ AddReserve( >+ { >+ branchcode => $patron->branchcode, >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $biblio->biblionumber, >+ priority => 1, >+ itemnumber => undef, >+ } >+ ) >+ ); >+ >+ $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id ) >+ ->status_is(204, 'SWAGGER3.2.4') >+ ->content_is('', 'SWAGGER3.3.4'); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.34.1
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 30780
:
135052
|
135080
|
135946
| 136031 |
136032