View | Details | Raw Unified | Return to bug 21567
Collapse All | Expand All

(-)a/t/Koha_ExternalContent_RecordedBooks.t (-43 lines)
Lines 1-42 Link Here
1
#!/usr/bin/env perl
2
3
use Modern::Perl;
4
5
use t::lib::Mocks;
6
use Test::More;
7
use Test::MockModule;
8
9
use Module::Load::Conditional qw( can_load );
10
11
plan tests => 3;
12
13
SKIP: {
14
    skip "cannot find WebService::ILS::RecordedBooks::Partner", 3
15
      unless can_load( modules => { 'WebService::ILS::RecordedBooks::Patron' => undef } );
16
17
    use_ok('Koha::ExternalContent::RecordedBooks');
18
19
    t::lib::Mocks::mock_preference('SessionStorage','tmp');
20
21
    t::lib::Mocks::mock_preference('RecordedBooksLibraryID', 'DUMMY');
22
    t::lib::Mocks::mock_preference('RecordedBooksClientSecret', 'DUMMY');
23
    t::lib::Mocks::mock_preference('RecordedBooksDomain', 'DUMMY');
24
25
    my $client = Koha::ExternalContent::RecordedBooks->new();
26
    local $@;
27
    eval { $client->search({query => "art"}) };
28
29
    ok($@ =~ /This endpoint can be called by authorized trusted app or trusted partner only/, "Invalid RecordedBooks partner credentials");
30
31
    SKIP: {
32
        skip "no RecordedBooks partner credentials", 1 unless $ENV{RECORDEDBOOKS_TEST_LIBRARY_ID};
33
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});
37
38
        $client = Koha::ExternalContent::RecordedBooks->new();
39
        my $res = $client->search({query => "art"});
40
        ok($res->{items}, "search")
41
    }
42
}
43
- 

Return to bug 21567