|
Lines 33-39
$schema->storage->txn_begin;
Link Here
|
| 33 |
|
33 |
|
| 34 |
subtest 'checkauth() tests' => sub { |
34 |
subtest 'checkauth() tests' => sub { |
| 35 |
|
35 |
|
| 36 |
plan tests => 1; |
36 |
plan tests => 2; |
| 37 |
|
37 |
|
| 38 |
my $patron = $builder->build({ source => 'Borrower', value => { flags => undef } })->{userid}; |
38 |
my $patron = $builder->build({ source => 'Borrower', value => { flags => undef } })->{userid}; |
| 39 |
|
39 |
|
|
Lines 47-52
subtest 'checkauth() tests' => sub {
Link Here
|
| 47 |
|
47 |
|
| 48 |
is( $userid, undef, 'checkauth() returns undef for userid if no logged in user (Bug 18275)' ); |
48 |
is( $userid, undef, 'checkauth() returns undef for userid if no logged in user (Bug 18275)' ); |
| 49 |
|
49 |
|
|
|
50 |
my $db_user_id = C4::Context->config('user'); |
| 51 |
my $db_user_pass = C4::Context->config('pass'); |
| 52 |
$cgi = Test::MockObject->new(); |
| 53 |
$cgi->mock( 'cookie', sub { return; } ); |
| 54 |
$cgi->mock( 'param', sub { |
| 55 |
my ( $self, $param ) = @_; |
| 56 |
if ( $param eq 'userid' ) { return $db_user_id; } |
| 57 |
elsif ( $param eq 'password' ) { return $db_user_pass; } |
| 58 |
else { return; } |
| 59 |
}); |
| 60 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, $authnotrequired ); |
| 61 |
is ( $userid, $db_user_id, 'If DB user is logging in, it should be considered as logged in, i.e. checkauth return the relevant userid' ); |
| 62 |
C4::Context->_new_userenv; # For next tests |
| 63 |
|
| 50 |
}; |
64 |
}; |
| 51 |
|
65 |
|
| 52 |
my $hash1 = hash_password('password'); |
66 |
my $hash1 = hash_password('password'); |
| 53 |
- |
|
|