Bug 20804: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3c9c7f4543)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2020-07-30 15:15:36 +02:00 committed by Lucas Gass
parent 7837657e04
commit 356d1ca888
1 changed files with 20 additions and 1 deletions

View File

@ -10,7 +10,7 @@ use CGI qw ( -utf8 );
use Test::MockObject;
use Test::MockModule;
use List::MoreUtils qw/all any none/;
use Test::More tests => 22;
use Test::More tests => 23;
use Test::Warn;
use t::lib::Mocks;
use t::lib::TestBuilder;
@ -391,4 +391,23 @@ subtest 'Check value of login_attempts in checkpw' => sub {
is( $patron->account_locked, 1, 'Check administrative lockout without pref' );
};
subtest '_timeout_syspref' => sub {
plan tests => 5;
t::lib::Mocks::mock_preference('timeout', "100");
is( C4::Auth::_timeout_syspref, 100, );
t::lib::Mocks::mock_preference('timeout', "2d");
is( C4::Auth::_timeout_syspref, 2*86400, );
t::lib::Mocks::mock_preference('timeout', "2D");
is( C4::Auth::_timeout_syspref, 2*86400, );
t::lib::Mocks::mock_preference('timeout', "10h");
is( C4::Auth::_timeout_syspref, 10*3600, );
t::lib::Mocks::mock_preference('timeout', "10x");
is( C4::Auth::_timeout_syspref, 600, );
};
$schema->storage->txn_rollback;