Bugzilla – Attachment 129001 Details for
Bug 29772
Make DELETE /patrons/:patron_id return error codes in error conditions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29772: Regression tests
Bug-29772-Regression-tests.patch (text/plain), 3.12 KB, created by
Jonathan Druart
on 2022-01-04 15:21:27 UTC
(
hide
)
Description:
Bug 29772: Regression tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-04 15:21:27 UTC
Size:
3.12 KB
patch
obsolete
>From 1a036ac9d9b8beaa05cef9b7a2b945b5b0ed1de3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 27 Dec 2021 11:37:35 -0300 >Subject: [PATCH] Bug 29772: Regression tests > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/api/v1/patrons.t | 32 ++++++++++++++++++++++++++------ > 1 file changed, 26 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index 96a98522a92..1be0279279f 100755 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -662,9 +662,14 @@ subtest 'delete() tests' => sub { > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > > t::lib::Mocks::mock_preference('AnonymousPatron', $patron->borrowernumber); >- $t->delete_ok("//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber) >- ->status_is(403, 'Anonymous patron cannot be deleted') >- ->json_is( { error => 'Anonymous patron cannot be deleted' } ); >+ $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) >+ ->status_is( 409, 'Anonymous patron cannot be deleted' ) >+ ->json_is( >+ { >+ error => 'Anonymous patron cannot be deleted', >+ error_code => 'is_anonymous_patron' >+ } >+ ); > t::lib::Mocks::mock_preference('AnonymousPatron', 0); # back to default > > t::lib::Mocks::mock_preference( 'borrowerRelationship', 'parent' ); >@@ -682,21 +687,36 @@ subtest 'delete() tests' => sub { > > $t->delete_ok("//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber) > ->status_is(409, 'Patron with checkouts cannot be deleted') >- ->json_is( { error => 'Pending checkouts prevent deletion' } ); >+ ->json_is( >+ { >+ error => 'Pending checkouts prevent deletion', >+ error_code => 'has_checkouts' >+ } >+ ); > > # Make sure it has no pending checkouts > $checkout->delete; > > $t->delete_ok("//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber) > ->status_is(409, 'Patron with debt cannot be deleted') >- ->json_is( { error => 'Pending debts prevent deletion' } ); >+ ->json_is( >+ { >+ error => 'Pending debts prevent deletion', >+ error_code => 'has_debt' >+ } >+ ); > > # Make sure it has no debt > $patron->account->pay({ amount => 10, debits => [ $debit ] }); > > $t->delete_ok("//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber) > ->status_is(409, 'Patron with guarantees cannot be deleted') >- ->json_is( { error => 'Patron is a guarantor and it prevents deletion' } ); >+ ->json_is( >+ { >+ error => 'Patron is a guarantor and it prevents deletion', >+ error_code => 'has_guarantees' >+ } >+ ); > > # Remove guarantee > $patron->guarantee_relationships->delete; >-- >2.25.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 29772
:
128924
|
128925
|
128926
|
128941
|
128942
|
128943
| 129001 |
129002
|
129003