Lines 21-26
use Modern::Perl;
Link Here
|
21 |
|
21 |
|
22 |
use Test::More tests => 1; |
22 |
use Test::More tests => 1; |
23 |
use Test::Mojo; |
23 |
use Test::Mojo; |
|
|
24 |
use Test::Warn; |
24 |
|
25 |
|
25 |
use t::lib::TestBuilder; |
26 |
use t::lib::TestBuilder; |
26 |
use t::lib::Mocks; |
27 |
use t::lib::Mocks; |
Lines 31-36
use Array::Utils qw( array_minus );
Link Here
|
31 |
use Koha::ERM::EUsage::CounterFiles; |
32 |
use Koha::ERM::EUsage::CounterFiles; |
32 |
use Koha::Database; |
33 |
use Koha::Database; |
33 |
|
34 |
|
|
|
35 |
my $schema = Koha::Database->new->schema; |
34 |
my $builder = t::lib::TestBuilder->new; |
36 |
my $builder = t::lib::TestBuilder->new; |
35 |
|
37 |
|
36 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
38 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
Lines 42-47
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
Link Here
|
42 |
subtest 'get() tests' => sub { |
44 |
subtest 'get() tests' => sub { |
43 |
plan tests => 5; |
45 |
plan tests => 5; |
44 |
|
46 |
|
|
|
47 |
$schema->storage->txn_begin; |
48 |
|
45 |
my $service_url = "https://registry.countermetrics.org/api/v1/sushi-service/b94bc981-fa16-4bf6-ba5f-6c113f7ffa0b/"; |
49 |
my $service_url = "https://registry.countermetrics.org/api/v1/sushi-service/b94bc981-fa16-4bf6-ba5f-6c113f7ffa0b/"; |
46 |
my @expected_fields = ( |
50 |
my @expected_fields = ( |
47 |
"api_key_info", |
51 |
"api_key_info", |
Lines 57-62
subtest 'get() tests' => sub {
Link Here
|
57 |
"id", |
61 |
"id", |
58 |
"ip_address_authorization", |
62 |
"ip_address_authorization", |
59 |
"ip_address_authorization_info", |
63 |
"ip_address_authorization_info", |
|
|
64 |
"last_audit", |
60 |
"migrations", |
65 |
"migrations", |
61 |
"notification_count", |
66 |
"notification_count", |
62 |
"notifications_url", |
67 |
"notifications_url", |
Lines 99-103
subtest 'get() tests' => sub {
Link Here
|
99 |
my @response_fields = map { $_ } keys %$sushi_service; |
104 |
my @response_fields = map { $_ } keys %$sushi_service; |
100 |
my @new_fields_in_response = array_minus( @response_fields, @expected_fields ); |
105 |
my @new_fields_in_response = array_minus( @response_fields, @expected_fields ); |
101 |
|
106 |
|
102 |
is( scalar(@new_fields_in_response), 0, 'The response fields match the expected fields' ); |
107 |
my $new_fields_string = |
|
|
108 |
"This is not a new error within Koha, the following new field(s) have been added to the API repsonse: " |
109 |
. join( ', ', @new_fields_in_response ) |
110 |
. '. They should be added to the API definition'; |
111 |
warning_like { scalar(@new_fields_in_response) } 0, $new_fields_string; |
112 |
|
113 |
$schema->storage->txn_rollback; |
103 |
}; |
114 |
}; |
104 |
- |
|
|