Bug 31795: (QA follow-up) Use x-koha-override header
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 10 Apr 2023 17:14:12 +0000 (14:14 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 5 May 2023 13:18:43 +0000 (10:18 -0300)
commit531d03e811811eb9f1afed1d94a40b072ec94b2f
treef386cffda0d0726a06bd7087508aa427df92715f
parent1cbe4c2e416b88ada7d03035bf0c4466cd867769
Bug 31795: (QA follow-up) Use x-koha-override header

Despite its title, this patch does a couple more things.

1. The tests are rewritten to cover more things, and also to avoid
   deleting all authorities inside the transaction. It is really not
   required.
2. It makes the endpoint rely on the already generically implemented
   x-koha-override header, which is intended for the same use case as
   x-confirm-not-duplicate is for.
3. It changes the return codes to match the coding guidelines [1]
4. Only checks for duplicates if no override passed.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/authorities.t
=> SUCCESS: Tests pass!
2. Apply this follow-up
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

[1] https://wiki.koha-community.org/wiki/Coding_Guidelines_-_API#SWAGGER3.2.1_POST

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/REST/V1/Authorities.pm
api/v1/swagger/paths/authorities.yaml
t/db_dependent/api/v1/authorities.t