Bug 23859

Summary: Cities endpoint not setting the Location header
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: minor    
Priority: P5 - low CC: martin.renvoize, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Bug Depends on: 23843    
Bug Blocks:    
Attachments: Bug 23859: Update tests to new style
Bug 23859: Regression tests
Bug 23859: Make POST add the Location header on cities endpoint
Bug 23859: Update tests to new style
Bug 23859: Regression tests
Bug 23859: Make POST add the Location header on cities endpoint
Bug 23859: Update tests to new style

Description Tomás Cohen Arazi 2019-10-21 17:37:00 UTC

    
Comment 1 Tomás Cohen Arazi 2019-10-21 19:12:38 UTC
Created attachment 94497 [details] [review]
Bug 23859: Update tests to new style

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi 2019-10-21 19:15:27 UTC
Created attachment 94498 [details] [review]
Bug 23859: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi 2019-10-21 19:15:32 UTC
Created attachment 94499 [details] [review]
Bug 23859: Make POST add the Location header on cities endpoint

According to the coding guidelines, this endpoint should be adding the
Location header on POST actions.

To test:
1. Apply the tests patch
2. Run:
    $ kshell
    k$ prove t/db_dependent/api/v1/cities.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat (1)
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2019-10-21 19:15:36 UTC
Created attachment 94500 [details] [review]
Bug 23859: Update tests to new style

The /cities endpoint is refered in several places as the reference
implementation of a route for devs to pick it for copy and pasting. Yet,
it is outdated in terms of how the tests are written.

This patch rewrites some bits so it uses BASIC auth and the built-ins
Test::Mojo provides.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Martin Renvoize 2019-11-01 08:42:15 UTC
Created attachment 94938 [details] [review]
Bug 23859: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2019-11-01 08:42:18 UTC
Created attachment 94939 [details] [review]
Bug 23859: Make POST add the Location header on cities endpoint

According to the coding guidelines, this endpoint should be adding the
Location header on POST actions.

To test:
1. Apply the tests patch
2. Run:
    $ kshell
    k$ prove t/db_dependent/api/v1/cities.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat (1)
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2019-11-01 08:42:22 UTC
Created attachment 94940 [details] [review]
Bug 23859: Update tests to new style

The /cities endpoint is refered in several places as the reference
implementation of a route for devs to pick it for copy and pasting. Yet,
it is outdated in terms of how the tests are written.

This patch rewrites some bits so it uses BASIC auth and the built-ins
Test::Mojo provides.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2019-11-01 08:43:27 UTC
Trivial patch that improves the consistency of our API's.

Passing QA
Comment 9 Martin Renvoize 2019-11-01 08:49:00 UTC
Nice work!

Pushed to master for 19.11.00