|
Lines 10-16
use CGI qw ( -utf8 );
Link Here
|
| 10 |
use Test::MockObject; |
10 |
use Test::MockObject; |
| 11 |
use Test::MockModule; |
11 |
use Test::MockModule; |
| 12 |
use List::MoreUtils qw/all any none/; |
12 |
use List::MoreUtils qw/all any none/; |
| 13 |
use Test::More tests => 23; |
13 |
use Test::More tests => 24; |
| 14 |
use Test::Warn; |
14 |
use Test::Warn; |
| 15 |
use t::lib::Mocks; |
15 |
use t::lib::Mocks; |
| 16 |
use t::lib::TestBuilder; |
16 |
use t::lib::TestBuilder; |
|
Lines 441-444
subtest '_timeout_syspref' => sub {
Link Here
|
| 441 |
is( C4::Auth::_timeout_syspref, 600, ); |
441 |
is( C4::Auth::_timeout_syspref, 600, ); |
| 442 |
}; |
442 |
}; |
| 443 |
|
443 |
|
|
|
444 |
subtest 'check_cookie_auth' => sub { |
| 445 |
plan tests => 1; |
| 446 |
|
| 447 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 1 } }); |
| 448 |
|
| 449 |
# Mock a CGI object with real userid param |
| 450 |
my $cgi = Test::MockObject->new(); |
| 451 |
$cgi->mock( |
| 452 |
'param', |
| 453 |
sub { |
| 454 |
my $var = shift; |
| 455 |
if ( $var eq 'userid' ) { return $patron->userid; } |
| 456 |
elsif ( $var eq 'timeout' ) { return 3600; } |
| 457 |
} |
| 458 |
); |
| 459 |
$cgi->mock('multi_param', sub {return q{}} ); |
| 460 |
$cgi->mock( 'cookie', sub { return; } ); |
| 461 |
$cgi->mock( 'request_method', sub { return 'POST' } ); |
| 462 |
|
| 463 |
# 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 |
|
| 466 |
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' ); |
| 468 |
}; |
| 469 |
|
| 444 |
$schema->storage->txn_rollback; |
470 |
$schema->storage->txn_rollback; |
| 445 |
- |
|
|