Bug 38390: Add subscriptions+count to vendors embed
This patch adds the subscriptions+count option to the embeddable enum for the /vendors endpoint. Test plan 1) Inspect the change to t/db_dependant/api/v1/acquisitions_vendors.t and confirm it's testing for the addition of subscriptions_count. 2) Run the above tests and confirm it passes Note: For the above tests to pass, you will need to ensure your api bundle is rebuilt after the patches are applied and restart plack. `yarn build && restart_all` in ktd Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
30bec5bb98
commit
ce5c7695e2
|
|
@ -119,6 +119,11 @@ properties:
|
|||
description: List of aliases
|
||||
items:
|
||||
$ref: "vendor_alias.yaml"
|
||||
subscriptions_count:
|
||||
type:
|
||||
- integer
|
||||
- "null"
|
||||
description: Number of linked subscriptions
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
type: string
|
||||
enum:
|
||||
- aliases
|
||||
- subscriptions+count
|
||||
collectionFormat: csv
|
||||
responses:
|
||||
"200":
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ my $t = Test::Mojo->new('Koha::REST::V1');
|
|||
|
||||
subtest 'list() and delete() tests | authorized user' => sub {
|
||||
|
||||
plan tests => 40;
|
||||
plan tests => 44;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
|
|
@ -100,6 +100,13 @@ subtest 'list() and delete() tests | authorized user' => sub {
|
|||
->json_is('/0/aliases/0/alias' => 'alias 1', 'alias 1 is embeded')
|
||||
->json_is('/0/aliases/1/alias' => 'alias 2', 'alias 2 is embeded');
|
||||
|
||||
for ( 0 .. 1 ) {
|
||||
$builder->build_object( { class => 'Koha::Subscriptions', value => { aqbooksellerid => $vendor->id } } );
|
||||
}
|
||||
$t->get_ok( "//$userid:$password@/api/v1/acquisitions/vendors" => { 'x-koha-embed' => 'subscriptions+count' } )
|
||||
->status_is(200)->json_has( '/0/subscriptions_count', 'subscriptions_count is embeded' )
|
||||
->json_is( '/0/subscriptions_count' => '2', 'subscription count is 2' );
|
||||
|
||||
$t->delete_ok( "//$userid:$password@/api/v1/acquisitions/vendors/" . $vendor->id )
|
||||
->status_is(204, 'SWAGGER3.2.4')
|
||||
->content_is('', 'SWAGGER3.3.4');
|
||||
|
|
|
|||
Loading…
Reference in New Issue