diff --git a/t/External/OverDrive.t b/t/External/OverDrive.t new file mode 100755 index 0000000000..b6134fad56 --- /dev/null +++ b/t/External/OverDrive.t @@ -0,0 +1,55 @@ +#!/usr/bin/perl + +# Copyright 2015 BibLibre +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, see . + +use Modern::Perl; +use C4::Context; +use t::lib::Mocks qw(mock_preference); +use Test::More tests => 6; + +BEGIN { + use_ok('C4::External::OverDrive'); +} + +can_ok( + 'C4::External::OverDrive', qw( + _request + IsOverDriveEnabled + GetOverDriveToken ) +); + +# ---------- Testing IsOverDriveEnabled --------- + +t::lib::Mocks::mock_preference( "OverDriveClientKey", 0 ); +t::lib::Mocks::mock_preference( "OverDriveClientSecret", 0 ); + +is( IsOverDriveEnabled(), 0, 'IsOverDriveEnabled fail' ); + +t::lib::Mocks::mock_preference( "OverDriveClientKey", 0 ); +t::lib::Mocks::mock_preference( "OverDriveClientSecret", 1 ); + +is( IsOverDriveEnabled(), 0, 'IsOverDriveEnabled fail' ); + +t::lib::Mocks::mock_preference( "OverDriveClientKey", 1 ); +t::lib::Mocks::mock_preference( "OverDriveClientSecret", 0 ); + +is( IsOverDriveEnabled(), 0, 'IsOverDriveEnabled fail' ); + +t::lib::Mocks::mock_preference( "OverDriveClientKey", 1 ); +t::lib::Mocks::mock_preference( "OverDriveClientSecret", 1 ); + +is( IsOverDriveEnabled(), 1, 'IsOverDriveEnabled success' ); diff --git a/t/External_Overdrive.t b/t/External_Overdrive.t deleted file mode 100755 index a6598466f4..0000000000 --- a/t/External_Overdrive.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -# -# This Koha test module is a stub! -# Add more tests here!!! - -use strict; -use warnings; - -use Test::More tests => 1; - -BEGIN { - use_ok('C4::External::OverDrive'); -}