Lines 442-448
subtest '_timeout_syspref' => sub {
Link Here
|
442 |
}; |
442 |
}; |
443 |
|
443 |
|
444 |
subtest 'check_cookie_auth' => sub { |
444 |
subtest 'check_cookie_auth' => sub { |
445 |
plan tests => 1; |
445 |
plan tests => 2; |
446 |
|
446 |
|
447 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 1 } }); |
447 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 1 } }); |
448 |
|
448 |
|
Lines 453-470
subtest 'check_cookie_auth' => sub {
Link Here
|
453 |
sub { |
453 |
sub { |
454 |
my $var = shift; |
454 |
my $var = shift; |
455 |
if ( $var eq 'userid' ) { return $patron->userid; } |
455 |
if ( $var eq 'userid' ) { return $patron->userid; } |
456 |
elsif ( $var eq 'timeout' ) { return 3600; } |
456 |
elsif ( $var eq 'timeout' ) { return 600; } |
457 |
} |
457 |
} |
458 |
); |
458 |
); |
459 |
$cgi->mock('multi_param', sub {return q{}} ); |
459 |
$cgi->mock('multi_param', sub {return q{}} ); |
460 |
$cgi->mock( 'cookie', sub { return; } ); |
460 |
my $sessionID; |
|
|
461 |
$cgi->mock( 'cookie', sub { return $sessionID; } ); |
461 |
$cgi->mock( 'request_method', sub { return 'POST' } ); |
462 |
$cgi->mock( 'request_method', sub { return 'POST' } ); |
462 |
|
463 |
|
463 |
# Setting authnotrequired=1 or we wont' hit the return but the end of the sub that prints headers |
464 |
# Setting authnotrequired=1 or we wont' hit the return but the end of the sub that prints headers |
464 |
my ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); |
465 |
my ( $userid, $cookie, $flags ); |
|
|
466 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); |
467 |
my $original_sessionID = $sessionID; |
465 |
|
468 |
|
466 |
my ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID, {catalogue => 1}); |
469 |
my ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID, {catalogue => 1}); |
467 |
is( $auth_status, 'anon', 'check_cookie_auth should not return ok if the user has not been authenticated before' ); |
470 |
is( $auth_status, 'anon', 'check_cookie_auth should not return ok if the user has not been authenticated before' ); |
|
|
471 |
|
472 |
( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); |
473 |
is( $original_sessionID, $sessionID, 'checkauth should not generate a different sessionID' ); |
468 |
}; |
474 |
}; |
469 |
|
475 |
|
470 |
$schema->storage->txn_rollback; |
476 |
$schema->storage->txn_rollback; |
471 |
- |
|
|