|
Lines 42-48
$schema->storage->txn_begin;
Link Here
|
| 42 |
|
42 |
|
| 43 |
subtest 'checkauth() tests' => sub { |
43 |
subtest 'checkauth() tests' => sub { |
| 44 |
|
44 |
|
| 45 |
plan tests => 9; |
45 |
plan tests => 10; |
| 46 |
|
46 |
|
| 47 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => undef } }); |
47 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => undef } }); |
| 48 |
|
48 |
|
|
Lines 136-141
subtest 'checkauth() tests' => sub {
Link Here
|
| 136 |
}; |
136 |
}; |
| 137 |
}; |
137 |
}; |
| 138 |
|
138 |
|
|
|
139 |
subtest 'cas_ticket must be empty in session' => sub { |
| 140 |
|
| 141 |
plan tests => 2; |
| 142 |
|
| 143 |
my $patron = $builder->build_object( |
| 144 |
{ class => 'Koha::Patrons', value => { flags => 1 } } ); |
| 145 |
my $password = 'password'; |
| 146 |
t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); |
| 147 |
$patron->set_password( { password => $password } ); |
| 148 |
$cgi = Test::MockObject->new(); |
| 149 |
$cgi->mock( 'cookie', sub { return; } ); |
| 150 |
$cgi->mock( |
| 151 |
'param', |
| 152 |
sub { |
| 153 |
my ( $self, $param ) = @_; |
| 154 |
if ( $param eq 'userid' ) { return $patron->userid; } |
| 155 |
elsif ( $param eq 'password' ) { return $password; } |
| 156 |
else { return; } |
| 157 |
} |
| 158 |
); |
| 159 |
|
| 160 |
$cgi->mock( 'request_method', sub { return 'POST' } ); |
| 161 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 'authrequired' ); |
| 162 |
is( $userid, $patron->userid, 'If librarian user is used and password with POST, they should be logged in' ); |
| 163 |
my $session = C4::Auth::get_session($sessionID); |
| 164 |
is( $session->param('cas_ticket'), undef ); |
| 165 |
|
| 166 |
}; |
| 167 |
|
| 139 |
subtest 'Template params tests (password_expired)' => sub { |
168 |
subtest 'Template params tests (password_expired)' => sub { |
| 140 |
|
169 |
|
| 141 |
plan tests => 1; |
170 |
plan tests => 1; |
| 142 |
- |
|
|