From 990b4d24c854371f30a273c0254282e92518ec58 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 4 Apr 2019 09:42:38 +0100 Subject: [PATCH] Bug 21336: (QA follow-up) Add tests for administrative lockout Signed-off-by: Martin Renvoize --- t/db_dependent/Koha/Patrons.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index 6acff6c2c0..8175a25b48 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -1121,7 +1121,7 @@ subtest 'libraries_where_can_see_patrons + can_see_patron_infos + search_limited }; subtest 'account_locked' => sub { - plan tests => 9; + plan tests => 13; my $patron = $builder->build({ source => 'Borrower', value => { login_attempts => 0 } }); $patron = Koha::Patrons->find( $patron->{borrowernumber} ); for my $value ( undef, '', 0 ) { @@ -1129,6 +1129,8 @@ subtest 'account_locked' => sub { is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' ); $patron->login_attempts(1)->store; is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' ); + $patron->login_attempts(-1)->store; + is( $patron->account_locked, 1, 'Feature is disabled but administrative lockout has been triggered' ); } t::lib::Mocks::mock_preference('FailedloginAttempts', 3); @@ -1138,6 +1140,8 @@ subtest 'account_locked' => sub { is( $patron->account_locked, 1, 'Patron has 3 failed attempts, account should be considered locked yet' ); $patron->login_attempts(4)->store; is( $patron->account_locked, 1, 'Patron could not have 4 failed attempts, but account should still be considered locked' ); + $patron->login_attempts(-1)->store; + is( $patron->account_locked, 1, 'Administrative lockout triggered' ); $patron->delete; }; -- 2.20.1