Bug 39007: [24.05] Update API spec and unit test
Test plan:
1) Run prove t/db_dependent/api/v1/erm_sushi_services.t - FAIL
2) Apply patch
3) Repeat step 1 - PASS
4) Inspect patch diff and note that last_audit has been added to the API definition
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Please enter the commit message for your changes. Lines starting
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
(cherry picked from commit 020a27cdd7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
7ba53849d5
commit
3f23d9d76a
|
|
@ -114,6 +114,9 @@ properties:
|
|||
type: array
|
||||
items:
|
||||
type: object
|
||||
last_audit:
|
||||
description: the last time the service was audited
|
||||
type: object
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use Modern::Perl;
|
|||
|
||||
use Test::More tests => 1;
|
||||
use Test::Mojo;
|
||||
use Test::Warn;
|
||||
|
||||
use t::lib::TestBuilder;
|
||||
use t::lib::Mocks;
|
||||
|
|
@ -31,6 +32,7 @@ use Array::Utils qw( array_minus );
|
|||
use Koha::ERM::EUsage::CounterFiles;
|
||||
use Koha::Database;
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
my $t = Test::Mojo->new('Koha::REST::V1');
|
||||
|
|
@ -42,6 +44,8 @@ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
|
|||
subtest 'get() tests' => sub {
|
||||
plan tests => 5;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $service_url = "https://registry.countermetrics.org/api/v1/sushi-service/b94bc981-fa16-4bf6-ba5f-6c113f7ffa0b/";
|
||||
my @expected_fields = (
|
||||
"api_key_info",
|
||||
|
|
@ -57,6 +61,7 @@ subtest 'get() tests' => sub {
|
|||
"id",
|
||||
"ip_address_authorization",
|
||||
"ip_address_authorization_info",
|
||||
"last_audit",
|
||||
"migrations",
|
||||
"notification_count",
|
||||
"notifications_url",
|
||||
|
|
@ -99,5 +104,11 @@ subtest 'get() tests' => sub {
|
|||
my @response_fields = map { $_ } keys %$sushi_service;
|
||||
my @new_fields_in_response = array_minus( @response_fields, @expected_fields );
|
||||
|
||||
is( scalar(@new_fields_in_response), 0, 'The response fields match the expected fields' );
|
||||
my $new_fields_string =
|
||||
"This is not a new error within Koha, the following new field(s) have been added to the API repsonse: "
|
||||
. join( ', ', @new_fields_in_response )
|
||||
. '. They should be added to the API definition';
|
||||
warning_like { scalar(@new_fields_in_response) } 0, $new_fields_string;
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue