Lines 34-47
use Koha::Database;
Link Here
|
34 |
# The Usage statistics module uses an external API to fetch data from the counter registry |
34 |
# The Usage statistics module uses an external API to fetch data from the counter registry |
35 |
# This test is designed to catch any changes in the response that the API provides so that we can react quickly to ensure the module still functions as expected |
35 |
# This test is designed to catch any changes in the response that the API provides so that we can react quickly to ensure the module still functions as expected |
36 |
|
36 |
|
|
|
37 |
my $schema = Koha::Database->new->schema; |
37 |
my $builder = t::lib::TestBuilder->new; |
38 |
my $builder = t::lib::TestBuilder->new; |
38 |
|
39 |
|
39 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
40 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
40 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
41 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
41 |
|
42 |
|
42 |
subtest 'get() tests' => sub { |
43 |
subtest 'get() tests' => sub { |
|
|
44 |
|
43 |
plan tests => 5; |
45 |
plan tests => 5; |
44 |
|
46 |
|
|
|
47 |
$schema->storage->txn_begin; |
48 |
|
45 |
my @expected_fields = ( |
49 |
my @expected_fields = ( |
46 |
"abbrev", |
50 |
"abbrev", |
47 |
"address", |
51 |
"address", |
Lines 90-93
subtest 'get() tests' => sub {
Link Here
|
90 |
my @new_fields_in_response = array_minus( @response_fields, @expected_fields ); |
94 |
my @new_fields_in_response = array_minus( @response_fields, @expected_fields ); |
91 |
|
95 |
|
92 |
is( scalar(@new_fields_in_response), 0, 'The response fields match the expected fields' ); |
96 |
is( scalar(@new_fields_in_response), 0, 'The response fields match the expected fields' ); |
|
|
97 |
|
98 |
$schema->storage->txn_rollback; |
93 |
}; |
99 |
}; |