Improve unit test (#2745)
This commit is contained in:
parent
a3c64ff3d7
commit
52bfd9f2c8
|
@ -1,4 +1,5 @@
|
|||
use Test::More;
|
||||
use IO::String;
|
||||
use strict;
|
||||
|
||||
require 't/test-lib.pm';
|
||||
|
@ -7,19 +8,64 @@ my $res;
|
|||
|
||||
my $client = LLNG::Manager::Test->new( {
|
||||
ini => {
|
||||
logLevel => 'error',
|
||||
'portalEnablePasswordDisplay' => 1,
|
||||
'browsersDontStorePassword' => 1
|
||||
logLevel => 'error',
|
||||
portalEnablePasswordDisplay => 1,
|
||||
browsersDontStorePassword => 1
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Display portal' );
|
||||
ok( $res->[2]->[0] =~ m%<i name="password" class="fa fa-eye-slash toggle-password">%,
|
||||
' toggle password icon found' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<i name="password" class="fa fa-eye-slash toggle-password">%,
|
||||
' toggle password icon found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
count(2);
|
||||
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
'/',
|
||||
IO::String->new('user=dwho&password=dwho'),
|
||||
length => 23,
|
||||
),
|
||||
'Auth query'
|
||||
);
|
||||
count(1);
|
||||
expectOK($res);
|
||||
my $id = expectCookie($res);
|
||||
|
||||
ok(
|
||||
$res = $client->_get(
|
||||
'/',
|
||||
cookie => "lemonldap=$id",
|
||||
accept => 'text/html'
|
||||
),
|
||||
'Get menu'
|
||||
);
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<i name="oldpassword" class="fa fa-eye-slash toggle-password">%,
|
||||
' toggle oldpassword icon found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<i name="newpassword" class="fa fa-eye-slash toggle-password">%,
|
||||
' toggle newpassword icon found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<i name="confirmpassword" class="fa fa-eye-slash toggle-password">%,
|
||||
' toggle confirmpassword icon found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<input id="newpassword" name="newpassword" type="text" class="form-control"%,
|
||||
' input type text found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
count(5);
|
||||
|
||||
$client->logout($id);
|
||||
clean_sessions();
|
||||
|
||||
done_testing( count() );
|
||||
|
|
|
@ -328,10 +328,10 @@ m%\Q<span trspan="passwordPolicySpecialChar">Allowed special characters:</span>
|
|||
' passwordPolicySpecialChar'
|
||||
) or print STDERR Dumper( $res->[2]->[0], 'passwordPolicySpecialChar' );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<span id=\'show-hide-icon-button\' class="fa fa-eye"></span>%,
|
||||
'Show/Hide toogle button'
|
||||
) or print STDERR Dumper( $res->[2]->[0], 'Toogle button' );
|
||||
$res->[2]->[0] !~
|
||||
m%class="fa fa-eye-slash toggle-password">%,
|
||||
' no toggle icon found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
count(8);
|
||||
|
||||
# Test $client->logout
|
||||
|
|
|
@ -13,7 +13,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
my ( $res, $user, $pwd );
|
||||
my $maintests = 19;
|
||||
my $maintests = 22;
|
||||
my $mailSend = 0;
|
||||
|
||||
my $mail2 = 0;
|
||||
|
@ -54,6 +54,7 @@ SKIP: {
|
|||
dbiAuthPasswordHash => '',
|
||||
dbiDynamicHashEnabled => 0,
|
||||
dbiMailCol => 'mail',
|
||||
portalEnablePasswordDisplay => 1,
|
||||
portalDisplayPasswordPolicy => 1,
|
||||
passwordPolicyActivation => 0,
|
||||
passwordResetAllowedRetries => 4,
|
||||
|
@ -97,7 +98,23 @@ SKIP: {
|
|||
|
||||
# Post mismatched passwords
|
||||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'token' );
|
||||
ok( $res->[2]->[0] =~ /newpassword/s, ' Ask for a new password #1' );
|
||||
ok( $res->[2]->[0] =~ /newpassword/s, ' Ask for a new password #1' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<i name="newpassword" class="fa fa-eye-slash toggle-password">%,
|
||||
' toggle newpassword icon found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<i name="confirmpassword" class="fa fa-eye-slash toggle-password">%,
|
||||
' toggle confirmpassword icon found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
ok(
|
||||
$res->[2]->[0] =~
|
||||
m%<input id="newpassword" name="newpassword" type="password" class="form-control"%,
|
||||
' input type password found'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
|
||||
$query .= '&newpassword=zz&confirmpassword=z';
|
||||
ok(
|
||||
|
@ -129,7 +146,8 @@ SKIP: {
|
|||
|
||||
# Post empty password 2
|
||||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'token' );
|
||||
ok( $res->[2]->[0] =~ /newpassword/s, ' Ask for a new password #3' );
|
||||
ok( $res->[2]->[0] =~ /newpassword/s, ' Ask for a new password #3' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
|
||||
$query .= '&newpassword=zz&confirmpassword=';
|
||||
ok(
|
||||
|
|
Loading…
Reference in New Issue