|
Lines 184-190
subtest 'get_balance() tests' => sub {
Link Here
|
| 184 |
|
184 |
|
| 185 |
subtest 'add_credit() tests' => sub { |
185 |
subtest 'add_credit() tests' => sub { |
| 186 |
|
186 |
|
| 187 |
plan tests => 18; |
187 |
plan tests => 19; |
| 188 |
|
188 |
|
| 189 |
$schema->storage->txn_begin; |
189 |
$schema->storage->txn_begin; |
| 190 |
|
190 |
|
|
Lines 209-217
subtest 'add_credit() tests' => sub {
Link Here
|
| 209 |
|
209 |
|
| 210 |
my $credit = { amount => 100 }; |
210 |
my $credit = { amount => 100 }; |
| 211 |
|
211 |
|
| 212 |
my $ret = $t->post_ok( |
212 |
my $ret = |
| 213 |
"//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => |
213 |
$t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit ) |
| 214 |
json => $credit )->status_is(201)->tx->res->json; |
214 |
->status_is(201) |
|
|
215 |
->header_is( |
| 216 |
'Location' => "/api/v1/patrons/$patron_id/account/credits/" . $t->tx->res->json->{account_line_id}, |
| 217 |
"REST3.4.1" |
| 218 |
)->tx->res->json; |
| 215 |
|
219 |
|
| 216 |
is_deeply( |
220 |
is_deeply( |
| 217 |
$ret, |
221 |
$ret, |
|
Lines 472-478
subtest 'list_debits() test' => sub {
Link Here
|
| 472 |
|
476 |
|
| 473 |
subtest 'add_debit() tests' => sub { |
477 |
subtest 'add_debit() tests' => sub { |
| 474 |
|
478 |
|
| 475 |
plan tests => 20; |
479 |
plan tests => 21; |
| 476 |
|
480 |
|
| 477 |
$schema->storage->txn_begin; |
481 |
$schema->storage->txn_begin; |
| 478 |
|
482 |
|
|
Lines 546-552
subtest 'add_debit() tests' => sub {
Link Here
|
| 546 |
|
550 |
|
| 547 |
my $account_line_id = $ret->{account_line_id}; |
551 |
my $account_line_id = $ret->{account_line_id}; |
| 548 |
|
552 |
|
| 549 |
$t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit )->status_is(201); |
553 |
$t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit ) |
|
|
554 |
->status_is(201) |
| 555 |
->header_is( |
| 556 |
'Location' => "/api/v1/patrons/$patron_id/account/debits/" . $t->tx->res->json->{account_line_id}, |
| 557 |
"REST3.4.1" |
| 558 |
); |
| 550 |
|
559 |
|
| 551 |
is( |
560 |
is( |
| 552 |
$account->outstanding_debits->total_outstanding, |
561 |
$account->outstanding_debits->total_outstanding, |
| 553 |
- |
|
|