View | Details | Raw Unified | Return to bug 21336
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patrons.t (-2 / +6 lines)
Lines 1121-1134 subtest 'libraries_where_can_see_patrons + can_see_patron_infos + search_limited Link Here
1121
};
1121
};
1122
1122
1123
subtest 'account_locked' => sub {
1123
subtest 'account_locked' => sub {
1124
    plan tests => 9;
1124
    plan tests => 13;
1125
    my $patron = $builder->build({ source => 'Borrower', value => { login_attempts => 0 } });
1125
    my $patron = $builder->build({ source => 'Borrower', value => { login_attempts => 0 } });
1126
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
1126
    $patron = Koha::Patrons->find( $patron->{borrowernumber} );
1127
    for my $value ( undef, '', 0 ) {
1127
    for my $value ( undef, '', 0 ) {
1128
        t::lib::Mocks::mock_preference('FailedloginAttempts', $value);
1128
        t::lib::Mocks::mock_preference('FailedloginAttempts', $value);
1129
        $patron->login_attempts(0)->store;
1129
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1130
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1130
        $patron->login_attempts(1)->store;
1131
        $patron->login_attempts(1)->store;
1131
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1132
        is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' );
1133
        $patron->login_attempts(-1)->store;
1134
        is( $patron->account_locked, 1, 'Feature is disabled but administrative lockout has been triggered' );
1132
    }
1135
    }
1133
1136
1134
    t::lib::Mocks::mock_preference('FailedloginAttempts', 3);
1137
    t::lib::Mocks::mock_preference('FailedloginAttempts', 3);
Lines 1138-1143 subtest 'account_locked' => sub { Link Here
1138
    is( $patron->account_locked, 1, 'Patron has 3 failed attempts, account should be considered locked yet' );
1141
    is( $patron->account_locked, 1, 'Patron has 3 failed attempts, account should be considered locked yet' );
1139
    $patron->login_attempts(4)->store;
1142
    $patron->login_attempts(4)->store;
1140
    is( $patron->account_locked, 1, 'Patron could not have 4 failed attempts, but account should still be considered locked' );
1143
    is( $patron->account_locked, 1, 'Patron could not have 4 failed attempts, but account should still be considered locked' );
1144
    $patron->login_attempts(-1)->store;
1145
    is( $patron->account_locked, 1, 'Administrative lockout triggered' );
1141
1146
1142
    $patron->delete;
1147
    $patron->delete;
1143
};
1148
};
1144
- 

Return to bug 21336