Bugzilla – Attachment 147640 Details for
Bug 32997
Add GET endpoint for listing authorised value categories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32997: (QA follow-up) values => authorised_values
Bug-32997-QA-follow-up-values--authorisedvalues.patch (text/plain), 4.60 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-03-02 14:46:57 UTC
(
hide
)
Description:
Bug 32997: (QA follow-up) values => authorised_values
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-03-02 14:46:57 UTC
Size:
4.60 KB
patch
obsolete
>From 9d7684ddc362b4728490e6c7c9de8a940875b42e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 2 Mar 2023 11:45:12 -0300 >Subject: [PATCH] Bug 32997: (QA follow-up) values => authorised_values > >This patch renames that for consistency, and also makes use of the >->authorised_values accessor on the category. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1/AuthorisedValues.pm | 3 +-- > api/v1/swagger/paths/authorised_values.yaml | 2 +- > api/v1/swagger/swagger.yaml | 4 ++-- > t/db_dependent/api/v1/authorised_values.t | 8 ++++---- > 4 files changed, 8 insertions(+), 9 deletions(-) > >diff --git a/Koha/REST/V1/AuthorisedValues.pm b/Koha/REST/V1/AuthorisedValues.pm >index add0fa5910e..56ce3277e66 100644 >--- a/Koha/REST/V1/AuthorisedValues.pm >+++ b/Koha/REST/V1/AuthorisedValues.pm >@@ -19,7 +19,6 @@ use Modern::Perl; > > use Mojo::Base 'Mojolicious::Controller'; > >-use Koha::AuthorisedValues; > use Koha::AuthorisedValueCategories; > > use Try::Tiny; >@@ -49,7 +48,7 @@ sub list_av_from_category { > } > > return try { >- my $av_set = Koha::AuthorisedValues->search( { category => $category_name } )->search_with_library_limits; >+ my $av_set = $category->authorised_values->search_with_library_limits; > my $avs = $c->objects->search($av_set); > return $c->render( status => 200, openapi => $avs ); > } catch { >diff --git a/api/v1/swagger/paths/authorised_values.yaml b/api/v1/swagger/paths/authorised_values.yaml >index 243729ceb76..298f3ec2294 100644 >--- a/api/v1/swagger/paths/authorised_values.yaml >+++ b/api/v1/swagger/paths/authorised_values.yaml >@@ -1,5 +1,5 @@ > --- >-"/authorised_value_categories/{authorised_value_category_name}/values": >+"/authorised_value_categories/{authorised_value_category_name}/authorised_values": > get: > x-mojo-to: AuthorisedValues#list_av_from_category > operationId: listAuthorisedValues >diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml >index cc3e1873a3d..c728f9d6d74 100644 >--- a/api/v1/swagger/swagger.yaml >+++ b/api/v1/swagger/swagger.yaml >@@ -145,8 +145,8 @@ paths: > $ref: paths/auth.yaml#/~1auth~1identity_providers~1{identity_provider_id}~1domains~1{identity_provider_domain_id} > /authorised_value_categories: > $ref: paths/authorised_value_categories.yaml#/~1authorised_value_categories >- "/authorised_value_categories/{authorised_value_category_name}/values": >- $ref: "./paths/authorised_values.yaml#/~1authorised_value_categories~1{authorised_value_category_name}~1values" >+ "/authorised_value_categories/{authorised_value_category_name}/authorised_values": >+ $ref: "./paths/authorised_values.yaml#/~1authorised_value_categories~1{authorised_value_category_name}~1authorised_values" > "/biblios/{biblio_id}": > $ref: "./paths/biblios.yaml#/~1biblios~1{biblio_id}" > "/biblios/{biblio_id}/checkouts": >diff --git a/t/db_dependent/api/v1/authorised_values.t b/t/db_dependent/api/v1/authorised_values.t >index cb6d8298210..187087d4408 100755 >--- a/t/db_dependent/api/v1/authorised_values.t >+++ b/t/db_dependent/api/v1/authorised_values.t >@@ -60,14 +60,14 @@ subtest 'list_av_from_category() tests' => sub { > > ## Authorized user tests > # No category, 404 expected >- $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/NON_EXISTS/values") >+ $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/NON_EXISTS/authorised_values") > ->status_is(404) > ->json_is( '/error' => 'Category not found' ); > > my $av_cat = $builder->build_object({ class => 'Koha::AuthorisedValueCategories' })->category_name; > > # No AVs, so empty array should be returned >- $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/values") >+ $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") > ->status_is(200) > ->json_is( [] ); > >@@ -75,12 +75,12 @@ subtest 'list_av_from_category() tests' => sub { > { class => 'Koha::AuthorisedValues', value => { category => $av_cat } } ); > > # One av created, should get returned >- $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/values") >+ $t->get_ok("//$userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") > ->status_is(200) > ->json_is( [$av->to_api] ); > > # Unauthorized access >- $t->get_ok("//$unauth_userid:$password@/api/v1/authorised_value_categories/$av_cat/values") >+ $t->get_ok("//$unauth_userid:$password@/api/v1/authorised_value_categories/$av_cat/authorised_values") > ->status_is(403); > > $schema->storage->txn_rollback; >-- >2.34.1
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 32997
:
146970
|
147224
|
147237
|
147296
|
147340
|
147341
| 147640