Improve unit test (#1667)
This commit is contained in:
parent
cc04740252
commit
09996f9894
@ -49,6 +49,22 @@ ok( $res->[2]->[0] =~ m%"PE85":"From lemonlap-ng.ini"%,
|
|||||||
count(9);
|
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
|
# Try yo authenticate
|
||||||
# -------------------
|
# -------------------
|
||||||
ok(
|
ok(
|
||||||
|
@ -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
|
## Try to authenticate
|
||||||
ok( $res = $client->_get( '/', accept => 'text/html' ),
|
ok( $res = $client->_get( '/', accept => 'text/html' ),
|
||||||
@ -47,7 +72,7 @@ ok( $res = $client->_post(
|
|||||||
);
|
);
|
||||||
count(1);
|
count(1);
|
||||||
|
|
||||||
my $id = expectCookie($res);
|
$id = expectCookie($res);
|
||||||
expectRedirection( $res, 'http://auth.example.com/' );
|
expectRedirection( $res, 'http://auth.example.com/' );
|
||||||
|
|
||||||
# CheckUser form
|
# CheckUser form
|
||||||
|
Loading…
Reference in New Issue
Block a user