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

(-)a/t/Koha_ExternalContent_RecordedBooks.t (-1 / +41 lines)
Line 0 Link Here
0
- 
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", 5
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
    ok($@ =~ /not authorized/, "Invalid RecordedBooks partner credentials");
29
30
    SKIP: {
31
        skip "no RecordedBooks partner credentials", 1 unless $ENV{RECORDEDBOOKS_TEST_LIBRARY_ID};
32
33
        t::lib::Mocks::mock_preference('RecordedBooksLibraryID', $ENV{RECORDEDBOOKS_TEST_LIBRARY_ID});
34
        t::lib::Mocks::mock_preference('RecordedBooksClientSecret', $ENV{RECORDEDBOOKS_TEST_CLIENT_SECRET});
35
        t::lib::Mocks::mock_preference('RecordedBooksDomain', $ENV{RECORDEDBOOKS_TEST_DOMAIN});
36
37
        $client = Koha::ExternalContent::RecordedBooks->new();
38
        my $res = $client->search({query => "art"});
39
        ok($res->{items}, "search")
40
    }
41
}

Return to bug 17602