Bugzilla – Attachment 120458 Details for
Bug 28254
Make it possible to override rules in PUT /holds/:hold_id/pickup_location
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28254: Add missing tests for PUT and POST
Bug-28254-Add-missing-tests-for-PUT-and-POST.patch (text/plain), 2.48 KB, created by
Jonathan Druart
on 2021-05-04 13:06:30 UTC
(
hide
)
Description:
Bug 28254: Add missing tests for PUT and POST
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-05-04 13:06:30 UTC
Size:
2.48 KB
patch
obsolete
>From 51252d6c3452a46d0a53f919a236218193538c5d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 May 2021 15:04:17 +0200 >Subject: [PATCH] Bug 28254: Add missing tests for PUT and POST > >--- > t/db_dependent/api/v1/holds.t | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index 49cd3a7df73..674172e6053 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 => 16; >+ plan tests => 18; > > $schema->storage->txn_begin; > >@@ -445,6 +445,12 @@ subtest 'x-koha-override and AllowHoldPolicyOverride tests' => sub { > { 'x-koha-override' => 'any' } => json => $post_data ) > ->status_is(201); > >+ t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0); >+ >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => >+ { 'x-koha-override' => 'any' } => json => $post_data ) >+ ->status_is(400); >+ > $schema->storage->txn_rollback; > }; > >@@ -1136,7 +1142,7 @@ subtest 'add() tests' => sub { > > subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > >- plan tests => 20; >+ plan tests => 28; > > $schema->storage->txn_begin; > >@@ -1251,5 +1257,23 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > > is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); > >+ $t->put_ok( "//$userid:$password@/api/v1/holds/" >+ . $hold->id >+ . "/pickup_location" => json => { pickup_library_id => $library_3->branchcode } ) >+ ->status_is(400) >+ ->json_is({ error => '[The supplied pickup location is not valid]' }); >+ >+ is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used' ); >+ >+ $t->put_ok( "//$userid:$password@/api/v1/holds/" >+ . $hold->id >+ . "/pickup_location" >+ => { 'x-koha-override' => 'any' } >+ => json => { pickup_library_id => $library_3->branchcode } ) >+ ->status_is(400) >+ ->json_is({ error => '[The supplied pickup location is not valid]' }); >+ >+ is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used, even if x-koha-override is passed' ); >+ > $schema->storage->txn_rollback; > }; >-- >2.20.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 28254
:
120281
|
120282
|
120283
|
120305
|
120306
|
120307
|
120337
|
120338
|
120339
|
120340
|
120457
| 120458