Improve unit test (#1667)

This commit is contained in:
Christophe Maudoux 2019-03-07 15:23:57 +01:00
parent cc04740252
commit 09996f9894
2 changed files with 42 additions and 1 deletions

View File

@ -49,6 +49,22 @@ ok( $res->[2]->[0] =~ m%"PE85":"From lemonlap-ng.ini"%,
count(9);
# Try yo authenticate
# -------------------
ok(
$res = $client->_post(
'/',
IO::String->new('user=dwho*&password=dwho'),
accept => 'text/html',
length => 24
),
'Auth query'
);
ok( $res->[2]->[0] =~ m%<span trmsg="40"></span>%,
' PE40 found' )
or print STDERR Dumper( $res->[2]->[0] );
count(2);
# Try yo authenticate
# -------------------
ok(

View File

@ -26,6 +26,31 @@ my $client = LLNG::Manager::Test->new(
}
);
## Try to authenticate with bad spoofed user
ok( $res = $client->_get( '/', accept => 'text/html' ),
'Get Menu', );
count(1);
my ( $host, $url, $query ) =
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
$query =~ s/user=/user=rtyler/;
$query =~ s/password=/password=rtyler/;
$query =~ s/spoofId=/spoofId=dwho*/;
ok( $res = $client->_post(
'/',
IO::String->new($query),
length => length($query),
accept => 'text/html',
),
'Auth query'
);
ok( $res->[2]->[0] =~ m%<span trmsg="40"></span>%,
' PE40 found' )
or print STDERR Dumper( $res->[2]->[0] );
count(2);
my $id = expectCookie($res);
$client->logout($id);
## Try to authenticate
ok( $res = $client->_get( '/', accept => 'text/html' ),
@ -47,7 +72,7 @@ ok( $res = $client->_post(
);
count(1);
my $id = expectCookie($res);
$id = expectCookie($res);
expectRedirection( $res, 'http://auth.example.com/' );
# CheckUser form