View | Details | Raw Unified | Return to bug 29914
Collapse All | Expand All

(-)a/t/db_dependent/Auth.t (-4 / +12 lines)
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 => 4;
446
446
447
    t::lib::Mocks::mock_preference('timeout', "1d"); # back to default
447
    t::lib::Mocks::mock_preference('timeout', "1d"); # back to default
448
448
Lines 464-471 subtest 'check_cookie_auth' => sub { Link Here
464
    # 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
465
    my ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 );
465
    my ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 );
466
466
467
    my ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID, {catalogue => 1});
467
    my ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID);
468
    is( $auth_status, 'anon', 'check_cookie_auth should not return ok if the user has not been authenticated before' );
468
    isnt( $auth_status, 'ok', 'check_cookie_auth should not return ok if the user has not been authenticated before if no permissions needed' );
469
    is( $auth_status, 'anon', 'check_cookie_auth should return anon if the user has not been authenticated before and no permissions needed' );
470
471
    ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 );
472
473
    ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID, {catalogue => 1});
474
    isnt( $auth_status, 'ok', 'check_cookie_auth should not return ok if the user has not been authenticated before and permissions needed' );
475
    is( $auth_status, 'anon', 'check_cookie_auth should return anon if the user has not been authenticated before and permissions needed' );
476
477
    #FIXME We should have a test to cover 'failed' status when a user has logged in, but doesn't have permission
469
};
478
};
470
479
471
$schema->storage->txn_rollback;
480
$schema->storage->txn_rollback;
472
- 

Return to bug 29914