Lines 684-690
subtest 'Check value of login_attempts in checkpw' => sub {
Link Here
|
684 |
}; |
684 |
}; |
685 |
|
685 |
|
686 |
subtest 'Check value of login_attempts in checkpw' => sub { |
686 |
subtest 'Check value of login_attempts in checkpw' => sub { |
687 |
plan tests => 2; |
687 |
plan tests => 3; |
688 |
|
688 |
|
689 |
t::lib::Mocks::mock_preference('FailedLoginAttempts', 3); |
689 |
t::lib::Mocks::mock_preference('FailedLoginAttempts', 3); |
690 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
690 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
Lines 697-702
subtest 'Check value of login_attempts in checkpw' => sub {
Link Here
|
697 |
@test = checkpw( $patron->userid, '123', undef, 'opac', 1 ); |
697 |
@test = checkpw( $patron->userid, '123', undef, 'opac', 1 ); |
698 |
is( $test[0], -2, 'Patron returned as expired correctly' ); |
698 |
is( $test[0], -2, 'Patron returned as expired correctly' ); |
699 |
|
699 |
|
|
|
700 |
## Make our patron the anonymous patron |
701 |
t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); |
702 |
@test = checkpw( $patron->userid, '123', undef, 'opac', 1 ); |
703 |
is ($test[0], -3, 'Patron returned as anonymous patron correctly' ); |
700 |
}; |
704 |
}; |
701 |
|
705 |
|
702 |
subtest '_timeout_syspref' => sub { |
706 |
subtest '_timeout_syspref' => sub { |
Lines 1075-1081
subtest 'checkpw() return values tests' => sub {
Link Here
|
1075 |
|
1079 |
|
1076 |
subtest 'Internal check tests' => sub { |
1080 |
subtest 'Internal check tests' => sub { |
1077 |
|
1081 |
|
1078 |
plan tests => 25; |
1082 |
plan tests => 29; |
1079 |
|
1083 |
|
1080 |
$schema->storage->txn_begin; |
1084 |
$schema->storage->txn_begin; |
1081 |
|
1085 |
|
Lines 1132-1137
subtest 'checkpw() return values tests' => sub {
Link Here
|
1132 |
is( ref( $return[1] ), 'Koha::Patron' ); |
1136 |
is( ref( $return[1] ), 'Koha::Patron' ); |
1133 |
is( $return[1]->id, $patron->id, 'Patron matched correctly' ); |
1137 |
is( $return[1]->id, $patron->id, 'Patron matched correctly' ); |
1134 |
|
1138 |
|
|
|
1139 |
t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); |
1140 |
@return = checkpw( $patron->userid, $password, undef, ); |
1141 |
|
1142 |
is( scalar @return, 2, "Two results on expired password scenario" ); |
1143 |
is( $return[0], -3, '-3 returned' ); |
1144 |
is( ref( $return[1] ), 'Koha::Patron' ); |
1145 |
is( $return[1]->id, $patron->id, 'Patron matched correctly' ); |
1146 |
|
1135 |
@return = checkpw( $unused_userid, $password, undef, ); |
1147 |
@return = checkpw( $unused_userid, $password, undef, ); |
1136 |
|
1148 |
|
1137 |
is( scalar @return, 2, "Two results on non-existing userid scenario" ); |
1149 |
is( scalar @return, 2, "Two results on non-existing userid scenario" ); |
Lines 1149-1155
subtest 'checkpw() return values tests' => sub {
Link Here
|
1149 |
|
1161 |
|
1150 |
subtest 'CAS check (mocked) tests' => sub { |
1162 |
subtest 'CAS check (mocked) tests' => sub { |
1151 |
|
1163 |
|
1152 |
plan tests => 25; |
1164 |
plan tests => 29; |
1153 |
|
1165 |
|
1154 |
$schema->storage->txn_begin; |
1166 |
$schema->storage->txn_begin; |
1155 |
|
1167 |
|
Lines 1216-1221
subtest 'checkpw() return values tests' => sub {
Link Here
|
1216 |
is( ref( $return[1] ), 'Koha::Patron' ); |
1228 |
is( ref( $return[1] ), 'Koha::Patron' ); |
1217 |
is( $return[1]->id, $patron->id, 'Patron matched correctly' ); |
1229 |
is( $return[1]->id, $patron->id, 'Patron matched correctly' ); |
1218 |
|
1230 |
|
|
|
1231 |
t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); |
1232 |
@return = checkpw( $patron->userid, $password, undef, ); |
1233 |
is( scalar @return, 2, "Two results on expired password scenario" ); |
1234 |
is( $return[0], -3, '-3 returned' ); |
1235 |
is( ref( $return[1] ), 'Koha::Patron' ); |
1236 |
is( $return[1]->id, $patron->id, 'Patron matched correctly' ); |
1237 |
|
1219 |
@return = checkpw( $unused_userid, $password, $query, ); |
1238 |
@return = checkpw( $unused_userid, $password, $query, ); |
1220 |
|
1239 |
|
1221 |
is( scalar @return, 2, "Two results on non-existing userid scenario" ); |
1240 |
is( scalar @return, 2, "Two results on non-existing userid scenario" ); |
1222 |
- |
|
|