Bugzilla – Attachment 121292 Details for
Bug 28424
POST /patrons/:patron_id/account/credits return value wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28424: Regression tests
Bug-28424-Regression-tests.patch (text/plain), 2.65 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-05-21 21:33:26 UTC
(
hide
)
Description:
Bug 28424: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-05-21 21:33:26 UTC
Size:
2.65 KB
patch
obsolete
>From ccba97693d605b6271b638dc8da7dea9acaa79f1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 21 May 2021 18:22:44 -0300 >Subject: [PATCH] Bug 28424: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/patrons_accounts.t | 23 ++++++++++++++--------- > 1 file changed, 14 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/api/v1/patrons_accounts.t b/t/db_dependent/api/v1/patrons_accounts.t >index fd7ab48afb6..68ca9386eba 100755 >--- a/t/db_dependent/api/v1/patrons_accounts.t >+++ b/t/db_dependent/api/v1/patrons_accounts.t >@@ -210,9 +210,10 @@ subtest 'add_credit() tests' => sub { > > my $credit = { amount => 100 }; > >- $t->post_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit) >- ->status_is(200) >- ->json_has('/account_line_id'); >+ my $ret = $t->post_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit) >+ ->status_is(201)->tx->res->json; >+ >+ is_deeply( $ret, Koha::Account::Lines->find( $ret->{account_line_id} )->to_api, 'Line returned correctly' ); > > my $outstanding_credits = $account->outstanding_credits; > is( $outstanding_credits->count, 1 ); >@@ -244,9 +245,11 @@ subtest 'add_credit() tests' => sub { > is( $account->outstanding_debits->total_outstanding, 25 ); > $credit->{library_id} = $library->id; > >- $t->post_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit) >- ->status_is(200) >- ->json_has('/account_line_id'); >+ $ret = $t->post_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit) >+ ->status_is(201) >+ ->tx->res->json; >+ >+ is_deeply( $ret, Koha::Account::Lines->find( $ret->{account_line_id} )->to_api, 'Line returned correctly' ); > > my $account_line_id = $t->tx->res->json->{account_line_id}; > is( Koha::Account::Lines->find($account_line_id)->branchcode, >@@ -272,9 +275,11 @@ subtest 'add_credit() tests' => sub { > account_lines_ids => [ $debit_1->id, $debit_2->id, $debit_3->id ] > }; > >- $t->post_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit) >- ->status_is(200) >- ->json_has('/account_line_id'); >+ $ret = $t->post_ok("//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit) >+ ->status_is(201) >+ ->tx->res->json; >+ >+ is_deeply( $ret, Koha::Account::Lines->find( $ret->{account_line_id} )->to_api, 'Line returned correctly' ); > > my $outstanding_debits = $account->outstanding_debits; > is( $outstanding_debits->total_outstanding, 65 ); >-- >2.31.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 28424
:
121292
|
121293
|
121294
|
121295
|
121304
|
121305
|
121306
|
121307