From 27a1ed22a804dccd498d207623bae91fe905e4ac Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 20 Jan 2025 17:01:50 -0300 Subject: [PATCH] Bug 38932: Regression tests Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Matt Blenkinsop --- t/db_dependent/api/v1/patrons_accounts.t | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/api/v1/patrons_accounts.t b/t/db_dependent/api/v1/patrons_accounts.t index df99f522d25..db2583bb7df 100755 --- a/t/db_dependent/api/v1/patrons_accounts.t +++ b/t/db_dependent/api/v1/patrons_accounts.t @@ -184,7 +184,7 @@ subtest 'get_balance() tests' => sub { subtest 'add_credit() tests' => sub { - plan tests => 18; + plan tests => 19; $schema->storage->txn_begin; @@ -209,9 +209,13 @@ subtest 'add_credit() tests' => sub { my $credit = { amount => 100 }; - my $ret = $t->post_ok( - "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => - json => $credit )->status_is(201)->tx->res->json; + my $ret = + $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/credits" => json => $credit ) + ->status_is(201) + ->header_is( + 'Location' => "/api/v1/patrons/$patron_id/account/credits/" . $t->tx->res->json->{account_line_id}, + "REST3.4.1" + )->tx->res->json; is_deeply( $ret, @@ -472,7 +476,7 @@ subtest 'list_debits() test' => sub { subtest 'add_debit() tests' => sub { - plan tests => 20; + plan tests => 21; $schema->storage->txn_begin; @@ -546,7 +550,12 @@ subtest 'add_debit() tests' => sub { my $account_line_id = $ret->{account_line_id}; - $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit )->status_is(201); + $t->post_ok( "//$userid:$password@/api/v1/patrons/$patron_id/account/debits" => json => $debit ) + ->status_is(201) + ->header_is( + 'Location' => "/api/v1/patrons/$patron_id/account/debits/" . $t->tx->res->json->{account_line_id}, + "REST3.4.1" + ); is( $account->outstanding_debits->total_outstanding, -- 2.48.1