9 use Module
::Load
::Conditional
qw( can_load );
14 skip
"cannot find WebService::ILS::RecordedBooks::Partner", 3
15 unless can_load
( modules
=> { 'WebService::ILS::RecordedBooks::Patron' => undef } );
17 use_ok
('Koha::ExternalContent::RecordedBooks');
19 t
::lib
::Mocks
::mock_preference
('SessionStorage','tmp');
21 t
::lib
::Mocks
::mock_preference
('RecordedBooksLibraryID', 'DUMMY');
22 t
::lib
::Mocks
::mock_preference
('RecordedBooksClientSecret', 'DUMMY');
23 t
::lib
::Mocks
::mock_preference
('RecordedBooksDomain', 'DUMMY');
25 my $client = Koha
::ExternalContent
::RecordedBooks
->new();
27 eval { $client->search({query
=> "art"}) };
29 ok
($@
=~ /This endpoint can be called by authorized trusted app or trusted partner only/, "Invalid RecordedBooks partner credentials");
32 skip
"no RecordedBooks partner credentials", 1 unless $ENV{RECORDEDBOOKS_TEST_LIBRARY_ID
};
34 t
::lib
::Mocks
::mock_preference
('RecordedBooksLibraryID', $ENV{RECORDEDBOOKS_TEST_LIBRARY_ID
});
35 t
::lib
::Mocks
::mock_preference
('RecordedBooksClientSecret', $ENV{RECORDEDBOOKS_TEST_CLIENT_SECRET
});
36 t
::lib
::Mocks
::mock_preference
('RecordedBooksDomain', $ENV{RECORDEDBOOKS_TEST_DOMAIN
});
38 $client = Koha
::ExternalContent
::RecordedBooks
->new();
39 my $res = $client->search({query
=> "art"});
40 ok
($res->{items
}, "search")