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

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

Return to bug 37104