From 3e545b48c6f3fe9263b9f790762d52e2a8f911c1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 30 Jul 2020 15:15:36 +0200 Subject: [PATCH] Bug 20804: Add tests Signed-off-by: Martin Renvoize --- t/db_dependent/Auth.t | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t index e149aec867..b836aa1cd0 100755 --- a/t/db_dependent/Auth.t +++ b/t/db_dependent/Auth.t @@ -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; -- 2.20.1