lemonldap-ng/lemonldap-ng-portal/t/61-Session-ActivityTimeout.t

71 lines
1.4 KiB
Perl
Raw Permalink Normal View History

2018-10-23 23:39:28 +02:00
use Test::More;
use strict;
use IO::String;
use Data::Dumper;
BEGIN {
require 't/test-lib.pm';
}
my $res;
2019-02-07 09:27:56 +01:00
my $client = LLNG::Manager::Test->new( {
2018-10-23 23:39:28 +02:00
ini => {
2018-11-26 14:40:21 +01:00
logLevel => 'error',
authentication => 'Demo',
userdb => 'Same',
timeoutActivity => 7200,
timeoutActivityInterval => 60,
2018-11-26 14:40:21 +01:00
handlerInternalCache => 1,
2018-10-23 23:39:28 +02:00
}
}
);
ok(
$res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23
),
'Auth query'
);
expectOK($res);
my $id1 = expectCookie($res);
count(1);
# Skip ahead in time before activity timeout
Time::Fake->offset("+20m");
2018-10-23 23:39:28 +02:00
ok(
$res = $client->_get(
'/',
cookie => "lemonldap=$id1",
accept => 'text/html',
),
'Go to Portal'
);
ok( $res->[2]->[0] =~ qr%<span trspan="yourApps">Your applications</span>%,
'Found applications list' )
or print STDERR Dumper( $res->[2]->[0] );
count(2);
# Skip ahead in time after activity timeout
Time::Fake->offset("+3h");
2018-10-23 23:39:28 +02:00
ok(
$res = $client->_get(
'/',
cookie => "lemonldap=$id1",
accept => 'text/html',
),
'Form Authentification'
);
2022-02-16 17:43:29 +01:00
ok( $res->[2]->[0] =~ m%<span trmsg="1">%, 'Found PE_SESSIONEXPIRED code' )
or print STDERR Dumper( $res->[2]->[0] );
2018-10-23 23:39:28 +02:00
count(2);
$client->logout($id1);
clean_sessions();
done_testing( count() );