File: overdrive-library.t

package info (click to toggle)
libwebservice-ils-perl 0.18-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 348 kB
  • sloc: perl: 2,645; makefile: 2; sh: 2
file content (43 lines) | stat: -rw-r--r-- 1,242 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

use Modern::Perl;

use Test::More tests => 4;
use Data::Dumper;

use FindBin;
use lib "$FindBin::Bin/lib";
use T::OverDrive;

use_ok('WebService::ILS::OverDrive::Library');

SKIP: {
    skip "Not testing OverDrive::Library API, WEBSERVICE_ILS_TEST_OVERDRIVE_LIBRARY not set", 3
      unless $ENV{WEBSERVICE_ILS_TEST_OVERDRIVE_LIBRARY};

    my $od_id     = $ENV{OVERDRIVE_TEST_CLIENT_ID}
        or BAIL_OUT("Env OVERDRIVE_TEST_CLIENT_ID not set");
    my $od_secret = $ENV{OVERDRIVE_TEST_CLIENT_SECRET}
        or BAIL_OUT("Env OVERDRIVE_TEST_CLIENT_SECRET not set");
    my $od_library_id = $ENV{OVERDRIVE_TEST_LIBRARY_ID}
        or BAIL_OUT("Env OVERDRIVE_TEST_LIBRARY_ID not set");

    my $od = WebService::ILS::OverDrive::Library->new({
        test => 1,
        client_id => $od_id,
        client_secret => $od_secret,
        library_id => $od_library_id,
    });

    # Standard interface
    #
    subtest "Standard search" => sub { T::OverDrive::search( $od ) };

    # Native interface
    #
    my $library = $od->native_library_account;
    ok( $library && $library->{name}, "Native library")
        or diag(Dumper($library));

    subtest "Native search"   => sub { T::OverDrive::native_search( $od ) };
}