Bugzilla – Attachment 153855 Details for
Bug 34365
Hold cancellation request workflow cannot be triggered on API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34365: Unit tests
Bug-34365-Unit-tests.patch (text/plain), 4.17 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-07-24 19:58:56 UTC
(
hide
)
Description:
Bug 34365: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-07-24 19:58:56 UTC
Size:
4.17 KB
patch
obsolete
>From 1dda754a183e10d53efb33a92f4ca92cf43b3d84 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 24 Jul 2023 16:08:22 -0300 >Subject: [PATCH] Bug 34365: Unit tests > >--- > api/v1/swagger/paths/holds.yaml | 12 +++++++ > t/db_dependent/api/v1/holds.t | 64 +++++++++++++++++++++++++++++---- > 2 files changed, 70 insertions(+), 6 deletions(-) > >diff --git a/api/v1/swagger/paths/holds.yaml b/api/v1/swagger/paths/holds.yaml >index 528656748b4..72bc7f77a2d 100644 >--- a/api/v1/swagger/paths/holds.yaml >+++ b/api/v1/swagger/paths/holds.yaml >@@ -379,9 +379,21 @@ > summary: Cancel hold > parameters: > - $ref: "../swagger.yaml#/parameters/hold_id_pp" >+ - name: x-koha-override >+ in: header >+ required: false >+ description: Overrides list sent as a request header >+ type: array >+ items: >+ type: string >+ enum: >+ - cancellation-request-flow >+ collectionFormat: csv > produces: > - application/json > responses: >+ "202": >+ description: Hold request recorded > "204": > description: Hold deleted > "401": >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index adc54296605..81c8e43939d 100755 >--- a/t/db_dependent/api/v1/holds.t >+++ b/t/db_dependent/api/v1/holds.t >@@ -1408,13 +1408,13 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { > > subtest 'delete() tests' => sub { > >- plan tests => 3; >+ plan tests => 13; > > $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 $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 >@@ -1454,9 +1454,61 @@ subtest 'delete() tests' => sub { > ) > ); > >- $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id ) >- ->status_is(204, 'SWAGGER3.2.4') >- ->content_is('', 'SWAGGER3.3.4'); >+ $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id )->status_is( 204, 'SWAGGER3.2.4' ) >+ ->content_is( '', 'SWAGGER3.3.4' ); >+ >+ $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 => { 'x-koha-override' => q{} } ) >+ ->status_is( 204, 'Same behavior if header not set' )->content_is(''); >+ >+ $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 => { 'x-koha-override' => q{cancellation-request-flow} } ) >+ ->status_is( 204, 'Same behavior if header set but hold not waiting' )->content_is(''); >+ >+ $hold = Koha::Holds->find( >+ AddReserve( >+ { >+ branchcode => $patron->branchcode, >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $biblio->biblionumber, >+ priority => 1, >+ itemnumber => undef, >+ } >+ ) >+ ); >+ >+ $hold->set_waiting; >+ >+ is( $hold->cancellation_requests->count, 0 ); >+ >+ $t->delete_ok( >+ "//$userid:$password@/api/v1/holds/" . $hold->id => { 'x-koha-override' => q{cancellation-request-flow} } ) >+ ->status_is( 202, 'Cancellation request accepted' ); >+ >+ is( $hold->cancellation_requests->count, 1 ); > > $schema->storage->txn_rollback; > }; >-- >2.39.2
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 34365
:
153855
|
153856
|
153935
|
153936
|
154154
|
154155