ef769ea332
t/Koha_ExternalContent_RecordedBooks.t skips more tests than scheduled if WebService::ILS is not available. Test plan: - have a system without Webservice::ILS available - in koha-shell, do prove t/Koha_ExternalContent_RecordedBooks.t - tests should be skipped and tests count as "passed" Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
42 lines
1.5 KiB
Perl
Executable file
42 lines
1.5 KiB
Perl
Executable file
#!/usr/bin/env perl
|
|
|
|
use Modern::Perl;
|
|
|
|
use t::lib::Mocks;
|
|
use Test::More;
|
|
use Test::MockModule;
|
|
|
|
use Module::Load::Conditional qw( can_load );
|
|
|
|
plan tests => 3;
|
|
|
|
SKIP: {
|
|
skip "cannot find WebService::ILS::RecordedBooks::Partner", 3
|
|
unless can_load( modules => { 'WebService::ILS::RecordedBooks::Patron' => undef } );
|
|
|
|
use_ok('Koha::ExternalContent::RecordedBooks');
|
|
|
|
t::lib::Mocks::mock_preference('SessionStorage','tmp');
|
|
|
|
t::lib::Mocks::mock_preference('RecordedBooksLibraryID', 'DUMMY');
|
|
t::lib::Mocks::mock_preference('RecordedBooksClientSecret', 'DUMMY');
|
|
t::lib::Mocks::mock_preference('RecordedBooksDomain', 'DUMMY');
|
|
|
|
my $client = Koha::ExternalContent::RecordedBooks->new();
|
|
local $@;
|
|
eval { $client->search({query => "art"}) };
|
|
|
|
ok($@ =~ /This endpoint can be called by authorized trusted app or trusted partner only/, "Invalid RecordedBooks partner credentials");
|
|
|
|
SKIP: {
|
|
skip "no RecordedBooks partner credentials", 1 unless $ENV{RECORDEDBOOKS_TEST_LIBRARY_ID};
|
|
|
|
t::lib::Mocks::mock_preference('RecordedBooksLibraryID', $ENV{RECORDEDBOOKS_TEST_LIBRARY_ID});
|
|
t::lib::Mocks::mock_preference('RecordedBooksClientSecret', $ENV{RECORDEDBOOKS_TEST_CLIENT_SECRET});
|
|
t::lib::Mocks::mock_preference('RecordedBooksDomain', $ENV{RECORDEDBOOKS_TEST_DOMAIN});
|
|
|
|
$client = Koha::ExternalContent::RecordedBooks->new();
|
|
my $res = $client->search({query => "art"});
|
|
ok($res->{items}, "search")
|
|
}
|
|
}
|