Bugzilla – Attachment 128924 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.00 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-12-27 14:41:43 UTC
(
hide
)
Description:
Bug 29772: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-12-27 14:41:43 UTC
Size:
3.00 KB
patch
obsolete
>From f43cfff38bfdbd99d935399c7cb7b6446bb807ee 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 > >--- > 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 96a98522a9..1be0279279 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.32.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 29772
:
128924
|
128925
|
128926
|
128941
|
128942
|
128943
|
129001
|
129002
|
129003