Bugzilla – Attachment 117763 Details for
Bug 27797
Make POST /holds use the stashed koha.overrides
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27797: (QA follow-up) Additional tests and operator change
Bug-27797-QA-follow-up-Additional-tests-and-operat.patch (text/plain), 2.66 KB, created by
Nick Clemens (kidclamp)
on 2021-03-04 19:52:33 UTC
(
hide
)
Description:
Bug 27797: (QA follow-up) Additional tests and operator change
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-03-04 19:52:33 UTC
Size:
2.66 KB
patch
obsolete
>From 3aeed8c61a8f1bad6dbb17e0c770b99144ef8530 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 4 Mar 2021 19:50:22 +0000 >Subject: [PATCH] Bug 27797: (QA follow-up) Additional tests and operator > change > >I added a few tests to cover additional cases and found the operator precedence >was failing, switched 'and' to '&&' > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/REST/V1/Holds.pm | 2 +- > t/db_dependent/api/v1/holds.t | 13 ++++++++++++- > 2 files changed, 13 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm >index 4112b9c3ee..b30fa4c6be 100644 >--- a/Koha/REST/V1/Holds.pm >+++ b/Koha/REST/V1/Holds.pm >@@ -172,7 +172,7 @@ sub add { > } > > my $overrides = $c->stash('koha.overrides'); >- my $can_override = $overrides->{any} and C4::Context->preference('AllowHoldPolicyOverride'); >+ my $can_override = $overrides->{any} && C4::Context->preference('AllowHoldPolicyOverride'); > > unless ( $can_override || $can_place_hold->{status} eq 'OK' ) { > return $c->render( >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index 57a318513d..b88e325d26 100755 >--- a/t/db_dependent/api/v1/holds.t >+++ b/t/db_dependent/api/v1/holds.t >@@ -358,7 +358,7 @@ $schema->storage->txn_rollback; > > subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { > >- plan tests => 8; >+ plan tests => 12; > > $schema->storage->txn_begin; > >@@ -407,6 +407,11 @@ subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { > ->status_is(403) > ->json_is( '/error' => "Hold cannot be placed. Reason: ageRestricted" ); > >+ # x-koha-override doesn't override if AllowHoldPolicyOverride not set >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => >+ { 'x-koha-override' => 'any' } => json => $post_data ) >+ ->status_is(403); >+ > t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); > > $can_item_be_reserved_result = { status => 'pickupNotInHoldGroup' }; >@@ -416,8 +421,14 @@ subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { > ->json_is( > '/error' => "Hold cannot be placed. Reason: pickupNotInHoldGroup" ); > >+ # x-koha-override overrides the status >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => >+ { 'x-koha-override' => 'any' } => json => $post_data ) >+ ->status_is(201); >+ > $can_item_be_reserved_result = { status => 'OK' }; > >+ # x-koha-override works when status not need override > $t->post_ok( "//$userid:$password@/api/v1/holds" => > { 'x-koha-override' => 'any' } => json => $post_data ) > ->status_is(201); >-- >2.11.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 27797
:
117498
|
117499
|
117540
|
117541
|
117761
|
117762
|
117763
|
117920
|
117929
|
117930
|
120285
|
120286
|
120287
|
120288
|
120289
|
120290