Append unit tests (#1509)
This commit is contained in:
parent
121356dcad
commit
d28991ec6b
68
lemonldap-ng-portal/t/61-Session-ActivityTimeout.t
Normal file
68
lemonldap-ng-portal/t/61-Session-ActivityTimeout.t
Normal file
|
@ -0,0 +1,68 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
use IO::String;
|
||||
use Data::Dumper;
|
||||
|
||||
BEGIN {
|
||||
require 't/test-lib.pm';
|
||||
}
|
||||
|
||||
my $res;
|
||||
|
||||
my $client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
logLevel => 'error',
|
||||
authentication => 'Demo',
|
||||
userdb => 'Same',
|
||||
timeoutActivity => 20,
|
||||
timeoutActivityInterval => 16,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
'/',
|
||||
IO::String->new('user=dwho&password=dwho'),
|
||||
length => 23
|
||||
),
|
||||
'Auth query'
|
||||
);
|
||||
expectOK($res);
|
||||
my $id1 = expectCookie($res);
|
||||
count(1);
|
||||
|
||||
sleep 17;
|
||||
|
||||
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);
|
||||
|
||||
sleep 21;
|
||||
|
||||
ok(
|
||||
$res = $client->_get(
|
||||
'/',
|
||||
cookie => "lemonldap=$id1",
|
||||
accept => 'text/html',
|
||||
),
|
||||
'Form Authentification'
|
||||
);
|
||||
ok( $res->[2]->[0] =~ m%<div class="message message-warning alert"><span trmsg="1"></span></div>%, 'Found PE_SESSIONEXPIRED code' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
count(2);
|
||||
|
||||
$client->logout($id1);
|
||||
clean_sessions();
|
||||
|
||||
done_testing( count() );
|
67
lemonldap-ng-portal/t/61-Session-Timeout.t
Normal file
67
lemonldap-ng-portal/t/61-Session-Timeout.t
Normal file
|
@ -0,0 +1,67 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
use IO::String;
|
||||
use Data::Dumper;
|
||||
|
||||
BEGIN {
|
||||
require 't/test-lib.pm';
|
||||
}
|
||||
|
||||
my $res;
|
||||
|
||||
my $client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
logLevel => 'error',
|
||||
authentication => 'Demo',
|
||||
userdb => 'Same',
|
||||
timeout => 30,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
'/',
|
||||
IO::String->new('user=dwho&password=dwho'),
|
||||
length => 23
|
||||
),
|
||||
'Auth query'
|
||||
);
|
||||
expectOK($res);
|
||||
my $id1 = expectCookie($res);
|
||||
count(1);
|
||||
|
||||
sleep 16;
|
||||
|
||||
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);
|
||||
|
||||
sleep 16;
|
||||
|
||||
ok(
|
||||
$res = $client->_get(
|
||||
'/',
|
||||
cookie => "lemonldap=$id1",
|
||||
accept => 'text/html',
|
||||
),
|
||||
'Form Authentification'
|
||||
);
|
||||
ok( $res->[2]->[0] =~ m%<div class="message message-warning alert"><span trmsg="1"></span></div>%, 'Found PE_SESSIONEXPIRED code' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
count(2);
|
||||
|
||||
$client->logout($id1);
|
||||
clean_sessions();
|
||||
|
||||
done_testing( count() );
|
Loading…
Reference in New Issue
Block a user