Commit 2e630967 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Improve history unit test - custom values (#1501)

parent 7e81d3b5
......@@ -9,20 +9,20 @@ BEGIN {
my $res;
my $client = LLNG::Manager::Test->new(
{
ini => {
logLevel => 'error',
authentication => 'Demo',
userDB => 'Same',
loginHistoryEnabled => 1,
brutForceProtection => 0,
{ ini => {
logLevel => 'error',
authentication => 'Demo',
userDB => 'Same',
loginHistoryEnabled => 1,
brutForceProtection => 0,
sessionDataToRemember =>
{ uid => 'identity', _auth => 'AuthModule' },
}
}
);
## First successful connection
ok(
$res = $client->_post(
ok( $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
......@@ -34,7 +34,7 @@ count(1);
expectOK($res);
my $id1 = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' )
or explain( $res->[2]->[0], 'trspan="noHistory"' );
or explain( $res->[2]->[0], 'trspan="noHistory"' );
my @c = ( $res->[2]->[0] =~ /<td>127.0.0.1/gs );
# History with 1 successLogin
......@@ -49,8 +49,7 @@ expectOK($res);
$client->logout($id1);
## Second successful connection
ok(
$res = $client->_post(
ok( $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
......@@ -72,8 +71,7 @@ count(2);
$client->logout($id1);
## First failed connection
ok(
$res = $client->_post(
ok( $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
......@@ -84,8 +82,7 @@ count(1);
expectReject($res);
## Second failed connection
ok(
$res = $client->_post(
ok( $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
......@@ -96,8 +93,7 @@ count(1);
expectReject($res);
## Third successful connection
ok(
$res = $client->_post(
ok( $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
......@@ -112,11 +108,15 @@ $id1 = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' );
@c = ( $res->[2]->[0] =~ /<td>127.0.0.1/gs );
my @cf = ( $res->[2]->[0] =~ /PE5<\/td>/gs );
my @ccv1 = ( $res->[2]->[0] =~ /<td>dwho<\/td>/gs );
my @ccv2 = ( $res->[2]->[0] =~ /<td>Demo<\/td>/gs );
# History with 5 entries
# History with 5 entries and 10 custom values
ok( @c == 5, ' -> Five entries found' );
ok( @cf == 2, " -> Two 'failedLogin' entries found" );
count(3);
ok( @ccv1 + @ccv2 == 10, " -> Ten custom value entries found" )
or print STDERR Dumper( $res->[2]->[0] );
count(4);
$client->logout($id1);
clean_sessions();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment