3 # Copyright 2015 BibLibre
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, see <http://www.gnu.org/licenses>.
21 use t
::lib
::Mocks
qw(mock_preference);
22 use Test
::More tests
=> 6;
25 use_ok
('C4::External::OverDrive');
29 'C4::External::OverDrive', qw(
35 # ---------- Testing IsOverDriveEnabled ---------
37 t
::lib
::Mocks
::mock_preference
( "OverDriveClientKey", 0 );
38 t
::lib
::Mocks
::mock_preference
( "OverDriveClientSecret", 0 );
40 is
( IsOverDriveEnabled
(), 0, 'IsOverDriveEnabled fail' );
42 t
::lib
::Mocks
::mock_preference
( "OverDriveClientKey", 0 );
43 t
::lib
::Mocks
::mock_preference
( "OverDriveClientSecret", 1 );
45 is
( IsOverDriveEnabled
(), 0, 'IsOverDriveEnabled fail' );
47 t
::lib
::Mocks
::mock_preference
( "OverDriveClientKey", 1 );
48 t
::lib
::Mocks
::mock_preference
( "OverDriveClientSecret", 0 );
50 is
( IsOverDriveEnabled
(), 0, 'IsOverDriveEnabled fail' );
52 t
::lib
::Mocks
::mock_preference
( "OverDriveClientKey", 1 );
53 t
::lib
::Mocks
::mock_preference
( "OverDriveClientSecret", 1 );
55 is
( IsOverDriveEnabled
(), 1, 'IsOverDriveEnabled success' );