Bugzilla – Attachment 109591 Details for
Bug 26271
Call to /api/v1/patrons/{patron_id}/account returns 500 error if manager_id is NULL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26271: Add failing test to reveal issue with patrons API endpoint
Bug-26271-Add-failing-test-to-reveal-issue-with-pa.patch (text/plain), 2.44 KB, created by
Martin Renvoize (ashimema)
on 2020-09-03 09:00:34 UTC
(
hide
)
Description:
Bug 26271: Add failing test to reveal issue with patrons API endpoint
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-09-03 09:00:34 UTC
Size:
2.44 KB
patch
obsolete
>From 1e76f0064d3f480d1a7c3fe0cea2f2089a2ed28e Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@helsinki.fi> >Date: Fri, 21 Aug 2020 16:21:42 +0300 >Subject: [PATCH] Bug 26271: Add failing test to reveal issue with patrons API > endpoint > >When manager_id is null/undef the API returns error code 500. > >To test: > 1) Notice failure when running > prove t/db_dependent/api/v1/patrons_accounts.t > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/api/v1/patrons_accounts.t | 36 +++++++++++++++++++++++- > 1 file changed, 35 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/patrons_accounts.t b/t/db_dependent/api/v1/patrons_accounts.t >index 5373f54c18..fd8bb39589 100644 >--- a/t/db_dependent/api/v1/patrons_accounts.t >+++ b/t/db_dependent/api/v1/patrons_accounts.t >@@ -40,7 +40,7 @@ my $t = Test::Mojo->new('Koha::REST::V1'); > > subtest 'get_balance() tests' => sub { > >- plan tests => 12; >+ plan tests => 15; > > $schema->storage->txn_begin; > >@@ -149,6 +149,40 @@ subtest 'get_balance() tests' => sub { > } > ); > >+ # Accountline without manager_id (happens with fines.pl cron for example) >+ my $account_line_3 = Koha::Account::Line->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ date => \'NOW()', >+ amount => 50, >+ description => "A description", >+ debit_type_code => "NEW_CARD", # New card >+ amountoutstanding => 50, >+ manager_id => undef, >+ branchcode => $library->id, >+ interface => 'test', >+ } >+ )->store(); >+ $account_line_3->discard_changes; >+ >+ $tx = $t->ua->build_tx( GET => "/api/v1/patrons/$patron_id/account" ); >+ $tx->req->cookies( { name => 'CGISESSID', value => $session_id } ); >+ $tx->req->env( { REMOTE_ADDR => '127.0.0.1' } ); >+ $t->request_ok($tx)->status_is(200)->json_is( >+ { balance => 40.00, >+ outstanding_debits => { >+ total => 50.00, >+ lines => [ >+ $account_line_3->to_api >+ ] >+ }, >+ outstanding_credits => { >+ total => -10, >+ lines => [ $credit_line->to_api ] >+ } >+ } >+ ); >+ > $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 26271
:
108820
|
108821
|
109583
|
109584
|
109585
| 109591 |
109592