Bugzilla – Attachment 85464 Details for
Bug 13895
Add routes for checkouts retrieval and renewal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13895: Change renewal endpoint
Bug-13895-Change-renewal-endpoint.patch (text/plain), 3.07 KB, created by
Josef Moravec
on 2019-02-21 16:46:51 UTC
(
hide
)
Description:
Bug 13895: Change renewal endpoint
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-02-21 16:46:51 UTC
Size:
3.07 KB
patch
obsolete
>From d69cbb3c550403f0fcd1b794089fdf1146cec3df Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Thu, 21 Feb 2019 00:26:17 +0000 >Subject: [PATCH] Bug 13895: Change renewal endpoint > >Instead of PUT on /checkout/{checkout_id} endpoint, you should now call >POST on /checkouts/{checkout_id}/renewal > >Test plan: >prove t/db_dependent/api/v1/checkouts.t >--- > api/v1/swagger/paths.json | 3 +++ > api/v1/swagger/paths/checkouts.json | 6 ++++-- > t/db_dependent/api/v1/checkouts.t | 8 ++++---- > 3 files changed, 11 insertions(+), 6 deletions(-) > >diff --git a/api/v1/swagger/paths.json b/api/v1/swagger/paths.json >index 28b021a..607ff12 100644 >--- a/api/v1/swagger/paths.json >+++ b/api/v1/swagger/paths.json >@@ -14,6 +14,9 @@ > "/checkouts/{checkout_id}": { > "$ref": "paths/checkouts.json#/~1checkouts~1{checkout_id}" > }, >+ "/checkouts/{checkout_id}/renewal": { >+ "$ref": "paths/checkouts.json#/~1checkouts~1{checkout_id}~1renewal" >+ }, > "/cities": { > "$ref": "paths/cities.json#/~1cities" > }, >diff --git a/api/v1/swagger/paths/checkouts.json b/api/v1/swagger/paths/checkouts.json >index 54aadd9..6324d75 100644 >--- a/api/v1/swagger/paths/checkouts.json >+++ b/api/v1/swagger/paths/checkouts.json >@@ -61,8 +61,10 @@ > "circulate": "circulate_remaining_permissions" > } > } >- }, >- "put": { >+ } >+ }, >+ "/checkouts/{checkout_id}/renewal": { >+ "post": { > "x-mojo-to": "Checkout#renew", > "operationId": "renewCheckout", > "tags": ["patrons", "checkouts"], >diff --git a/t/db_dependent/api/v1/checkouts.t b/t/db_dependent/api/v1/checkouts.t >index a5b9c54..a6f340b 100644 >--- a/t/db_dependent/api/v1/checkouts.t >+++ b/t/db_dependent/api/v1/checkouts.t >@@ -136,21 +136,21 @@ $dbh->do(q{ > }, {}, '*', '*', '*', 7, 1); > > my $expected_datedue = DateTime->now->add(days => 14)->set(hour => 23, minute => 59, second => 0); >-$t->put_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id) >+$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 }) ); > >-$t->put_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id) >+$t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id . "/renewal" ) > ->status_is(403) > ->json_is({ error => "Authorization failure. Missing required permission(s).", > required_permissions => { circulate => "circulate_remaining_permissions" } > }); > >-$t->put_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id) >+$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}) ); > >-$t->put_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id) >+$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" ) > ->status_is(403) > ->json_is({ error => 'Renewal not authorized (too_many)' }); > >-- >2.1.4
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 13895
:
37146
|
40104
|
40143
|
40588
|
41163
|
41548
|
45817
|
50021
|
51303
|
53816
|
53817
|
53878
|
53889
|
53890
|
53891
|
53901
|
53924
|
54196
|
54685
|
54951
|
56167
|
56506
|
58387
|
69123
|
84765
|
85458
|
85459
|
85460
|
85461
|
85462
|
85463
|
85464
|
85676
|
86120
|
86576
|
86579
|
86580
|
87105
|
87106
|
87107
|
87108
|
87109
|
87110
|
87111
|
87112
|
87113
|
87114
|
87115
|
87200