From a57d0fe74597680ff24968e1596857c9a7133072 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 Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit 3c9c7f4543a06553c6cbf04ff58a82eb6a40fc9c) Signed-off-by: Lucas Gass (cherry picked from commit 356d1ca888b3591bde960f30c43e6afcd93b66dc) Signed-off-by: Aleisha Amohia --- 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 100644 --- 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