Fix warning messages

This commit is contained in:
Christophe Maudoux 2020-02-16 14:35:14 +01:00
parent 8cf9f01e5d
commit 849609aec3
12 changed files with 41 additions and 39 deletions

View File

@ -48,7 +48,7 @@ is( $sessiondata->{authenticationLevel}, 3, "Overriden authentication level" );
$client->logout($id);
# Authenticate on second choice
my $postString = 'user=dwho&password=dwho&test=2_null';
$postString = 'user=dwho&password=dwho&test=2_null';
# Try to authenticate
# -------------------
@ -61,9 +61,9 @@ ok(
'Auth query'
);
expectOK($res);
my $id = expectCookie($res);
$id = expectCookie($res);
ok( $res = $client->_get("/sessions/global/$id"), 'Get session' );
my $sessiondata = from_json( $res->[2]->[0] );
$sessiondata = from_json( $res->[2]->[0] );
is( $sessiondata->{authenticationLevel}, 1, "Default authentication level" );
$client->logout($id);
clean_sessions();

View File

@ -97,7 +97,7 @@ ok(
my $idpId = expectCookie($res);
# Get code for RP1
my $query =
$query =
"response_type=code&scope=openid%20profile%20email&client_id=rpid&state=af0ifjsldkj&redirect_uri=http%3A%2F%2Frp2.com%2F";
ok(
$res = $op->_get(
@ -131,7 +131,7 @@ my $json = from_json( $res->[2]->[0] );
my $token = $json->{access_token};
ok( $token, 'Access token present' );
my $query = "token=$token";
$query = "token=$token";
ok(
$res = $op->_post(
"/oauth2/introspect",
@ -146,7 +146,7 @@ ok(
);
expectOK($res);
my $json = from_json( $res->[2]->[0] );
$json = from_json( $res->[2]->[0] );
ok( $json->{active}, "Token is valid" );
is( $json->{sub}, "french", "Response contains the correct sub" );

View File

@ -167,7 +167,7 @@ SKIP: {
ok( $res->[2]->[0] =~ /<span trmsg="82"><\/span>/, 'Token expired' )
or print STDERR Dumper( $res->[2]->[0] );
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Get Menu', );
my ( $host, $url, $query ) =
( $host, $url, $query ) =
expectForm( $res, '#', undef, 'user', 'password', 'token' );
}
count($maintests);

View File

@ -213,7 +213,7 @@ ok(
),
'Malformed query'
);
my $json;
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
or print STDERR "$@\n" . Dumper($res);
ok( $json->{error} eq 'Missing parameter', ' Missing parameter' )
@ -229,7 +229,7 @@ ok(
),
'Bad query'
);
my $json;
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
or print STDERR "$@\n" . Dumper($res);
ok( !$json->{result}, ' Result is 0' )

View File

@ -233,7 +233,7 @@ m%<span notif=\'testref\' epoch=\'(\d{10})\' class="btn btn-success" role="butto
),
'Malformed query'
);
my $json;
$json;
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
or print STDERR "$@\n" . Dumper($res);
ok( $json->{error} eq 'Missing parameter', ' Missing parameter' )

View File

@ -131,9 +131,9 @@ q{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00',?,
/<input type="hidden" name="reference[\dx]+" value="(\w+?)">/gs );
ok( @refs == 2, 'Two notification references found' )
or print STDERR Dumper( $res->[2]->[0] );
ok( @refs[0] eq 'testref2', '1st reference found is "testref2"' )
ok( $refs[0] eq 'testref2', '1st reference found is "testref2"' )
or print STDERR Dumper( $res->[2]->[0] );
ok( @refs[1] eq 'testref', '2nd reference found is "testref"' )
ok( $refs[1] eq 'testref', '2nd reference found is "testref"' )
or print STDERR Dumper( $res->[2]->[0] );
expectForm( $res, undef, '/notifback', 'reference1x1', 'url' );

View File

@ -138,9 +138,9 @@ SKIP: {
/<input type="hidden" name="reference[\dx]+" value="(\w+?)">/gs );
ok( @refs == 2, 'Two notification references found' )
or print STDERR Dumper( $res->[2]->[0] );
ok( @refs[0] eq 'testref2', '1st reference found is "testref2"' )
ok( $refs[0] eq 'testref2', '1st reference found is "testref2"' )
or print STDERR Dumper( $res->[2]->[0] );
ok( @refs[1] eq 'testref', '2nd reference found is "testref"' )
ok( $refs[1] eq 'testref', '2nd reference found is "testref"' )
or print STDERR Dumper( $res->[2]->[0] );
expectForm( $res, undef, '/notifback', 'reference1x1', 'url' );

View File

@ -99,7 +99,8 @@ SKIP: {
'Auth query'
);
expectOK($res);
my $id = expectCookie($res);
$id
= expectCookie($res);
expectForm( $res, undef, '/notifback', 'reference1x1', 'url' );
# Verify that cookie is ciphered (session unvalid)

View File

@ -220,7 +220,7 @@ lkRrWfQftwmLyNIu3HfSgXlgAZS30ymfbzBU
# ------------------------
ok( $res = $client->_get( '/certificateReset', accept => 'text/html' ),
'Reset form', );
my ( $host, $url, $query ) = expectForm( $res, '#', undef, 'mail' );
( $host, $url, $query ) = expectForm( $res, '#', undef, 'mail' );
$query = 'mail=dwho%40badwolf.org';
@ -236,8 +236,8 @@ lkRrWfQftwmLyNIu3HfSgXlgAZS30ymfbzBU
ok( mail() =~ m#a href="http://auth.example.com/certificateReset\?(.*?)"#,
'Found link in mail' );
$query = $1;
my $querymail = $query;
$query = $1;
$querymail = $query;
ok(
$res = $client->_get(
'/certificateReset',
@ -253,11 +253,11 @@ lkRrWfQftwmLyNIu3HfSgXlgAZS30ymfbzBU
ok( $res->[2]->[0] =~ /certif/s, ' Ask for a new certificate file' );
#print STDERR Dumper($query);
my %inputs = split( /[=&]/, $query );
my %querytab = split( /[=&]/, $querymail );
%inputs = split( /[=&]/, $query );
%querytab = split( /[=&]/, $querymail );
# Create the certificate file
my $cert = "INVALID CERTIFICATE";
$cert = "INVALID CERTIFICATE";
open my $FH2, '>', '/tmp/v296ZJQ_kG';
print {$FH2} "$cert";

View File

@ -225,7 +225,7 @@ lkRrWfQftwmLyNIu3HfSgXlgAZS30ymfbzBU
# ------------------------
ok( $res = $client->_get( '/certificateReset', accept => 'text/html' ),
'Reset form', );
my ( $host, $url, $query ) = expectForm( $res, '#', undef, 'mail' );
( $host, $url, $query ) = expectForm( $res, '#', undef, 'mail' );
$query = 'mail=dwho%40badwolf.org';
@ -241,8 +241,8 @@ lkRrWfQftwmLyNIu3HfSgXlgAZS30ymfbzBU
ok( mail() =~ m#a href="http://auth.example.com/certificateReset\?(.*?)"#,
'Found link in mail' );
$query = $1;
my $querymail = $query;
$query = $1;
$querymail = $query;
ok(
$res = $client->_get(
'/certificateReset',
@ -258,11 +258,11 @@ lkRrWfQftwmLyNIu3HfSgXlgAZS30ymfbzBU
ok( $res->[2]->[0] =~ /certif/s, ' Ask for a new certificate file' );
#print STDERR Dumper($query);
my %inputs = split( /[=&]/, $query );
my %querytab = split( /[=&]/, $querymail );
%inputs = split( /[=&]/, $query );
%querytab = split( /[=&]/, $querymail );
# Create the certificate file
my $cert = "INVALID CERTIFICATE";
$cert = "INVALID CERTIFICATE";
open my $FH2, '>', '/tmp/v296ZJQ_kG';
print {$FH2} "$cert";

View File

@ -64,13 +64,13 @@ SKIP: {
);
ok( $res->[2]->[0] =~ /totpregistration\.(?:min\.)?js/, 'Found TOTP js' );
ok(
$res->[2]->[0] =~ qr%<img src="/static/common/logos/logo_llng_old\.png"%,
$res->[2]->[0] =~
qr%<img src="/static/common/logos/logo_llng_old\.png"%,
'Found custom Main Logo'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~ qr%<span id="languages"></span>%,
'Language icons found'
) or print STDERR Dumper( $res->[2]->[0] );
ok( $res->[2]->[0] =~ qr%<span id="languages"></span>%,
'Language icons found' )
or print STDERR Dumper( $res->[2]->[0] );
# Register TOTP
# JS query
@ -231,7 +231,7 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ==
version => "U2F_V2"
}
);
my ( $host, $url, $query );
( $host, $url, $query );
$query = Lemonldap::NG::Common::FormEncode::build_urlencoded(
registration => $registrationData,
challenge => $res->[2]->[0],

View File

@ -9,6 +9,7 @@ require 't/smtp.pm';
use_ok('Lemonldap::NG::Common::FormEncode');
count(1);
my $res;
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
@ -42,7 +43,7 @@ my $client = LLNG::Manager::Test->new( {
# Login with rtyler
# -----------------
ok(
my $res = $client->_post(
$res = $client->_post(
'/',
IO::String->new('user=rtyler&password=rtyler'),
length => 27,
@ -88,7 +89,7 @@ clean_sessions();
# Login with dwho
# ---------------
ok(
my $res = $client->_post(
$res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23,
@ -99,7 +100,7 @@ ok(
count(1);
# Expect choice page
my ( $host, $url, $query ) =
( $host, $url, $query ) =
expectForm( $res, undef, '/2fchoice', 'token', 'checkLogins' );
ok(
@ -136,7 +137,7 @@ ok(
);
count(1);
my ( $host, $url, $query ) =
( $host, $url, $query ) =
expectForm( $res, undef, '/home2fcheck?skin=bootstrap', 'token', 'code' );
ok(
@ -149,7 +150,7 @@ count(1);
ok( mail() =~ m%<b>(\w{4})</b>%, 'Found 2F code in mail' )
or print STDERR Dumper( mail() );
my $code = $1;
$code = $1;
count(1);
$query =~ s/code=/code=${code}/;
@ -163,7 +164,7 @@ ok(
'Post code'
);
count(1);
my $id = expectCookie($res);
$id = expectCookie($res);
$client->logout($id);
clean_sessions();