@@ -, +, @@ --- t/db_dependent/Auth.t | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/t/db_dependent/Auth.t +++ a/t/db_dependent/Auth.t @@ -442,7 +442,7 @@ subtest '_timeout_syspref' => sub { }; subtest 'check_cookie_auth' => sub { - plan tests => 1; + plan tests => 2; my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 1 } }); @@ -453,18 +453,24 @@ subtest 'check_cookie_auth' => sub { sub { my $var = shift; if ( $var eq 'userid' ) { return $patron->userid; } - elsif ( $var eq 'timeout' ) { return 3600; } + elsif ( $var eq 'timeout' ) { return 600; } } ); $cgi->mock('multi_param', sub {return q{}} ); - $cgi->mock( 'cookie', sub { return; } ); + my $sessionID; + $cgi->mock( 'cookie', sub { return $sessionID; } ); $cgi->mock( 'request_method', sub { return 'POST' } ); # Setting authnotrequired=1 or we wont' hit the return but the end of the sub that prints headers - my ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); + my ( $userid, $cookie, $flags ); + ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); + my $original_sessionID = $sessionID; my ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID, {catalogue => 1}); is( $auth_status, 'anon', 'check_cookie_auth should not return ok if the user has not been authenticated before' ); + + ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); + is( $original_sessionID, $sessionID, 'checkauth should not generate a different sessionID' ); }; $schema->storage->txn_rollback; --