Bug 13895: (follow-up) Fix POST response
Test plan:
prove t/db_dependent/api/v1/chcekouts.t
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 47ad7afcca)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
1a4a1170ee
commit
ab1895b1ad
|
|
@ -118,8 +118,9 @@ sub renew {
|
|||
AddRenewal($borrowernumber, $itemnumber, $checkout->branchcode);
|
||||
$checkout = Koha::Checkouts->find($checkout_id);
|
||||
|
||||
$c->res->headers->location( $c->req->url->to_string );
|
||||
return $c->render(
|
||||
status => 200,
|
||||
status => 201,
|
||||
openapi => _to_api( $checkout->TO_JSON )
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
}],
|
||||
"produces": ["application/json"],
|
||||
"responses": {
|
||||
"200": {
|
||||
"201": {
|
||||
"description": "Updated borrower's checkout",
|
||||
"schema": { "$ref": "../definitions.json#/checkout" }
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 51;
|
||||
use Test::More tests => 53;
|
||||
use Test::MockModule;
|
||||
use Test::Mojo;
|
||||
use t::lib::Mocks;
|
||||
|
|
@ -137,8 +137,9 @@ $dbh->do(q{
|
|||
|
||||
my $expected_datedue = DateTime->now->add(days => 14)->set(hour => 23, minute => 59, second => 0);
|
||||
$t->post_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )
|
||||
->status_is(200)
|
||||
->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) );
|
||||
->status_is(201)
|
||||
->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) )
|
||||
->header_is(Location => "/api/v1/checkouts/" . $issue1->issue_id . "/renewal");
|
||||
|
||||
$t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id . "/renewal" )
|
||||
->status_is(403)
|
||||
|
|
@ -147,8 +148,10 @@ $t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->i
|
|||
});
|
||||
|
||||
$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/renewal" )
|
||||
->status_is(200)
|
||||
->json_is('/due_date' => output_pref({ dateformat => "rfc3339", dt => $expected_datedue}) );
|
||||
->status_is(201)
|
||||
->json_is('/due_date' => output_pref({ dateformat => "rfc3339", dt => $expected_datedue}) )
|
||||
->header_is(Location => "/api/v1/checkouts/" . $issue2->issue_id . "/renewal");
|
||||
|
||||
|
||||
$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )
|
||||
->status_is(403)
|
||||
|
|
|
|||
Loading…
Reference in New Issue