Improve unit test (#2019)

This commit is contained in:
Christophe Maudoux 2019-12-28 12:14:47 +01:00
parent 9a86559847
commit 7b064542f2
4 changed files with 24 additions and 5 deletions

View File

@ -5,7 +5,7 @@ use strict;
require 't/test-lib.pm';
my $res;
my $maintests = 14;
my $maintests = 16;
SKIP: {
eval 'use GD::SecurityImage;use Image::Magick;';
if ($@) {
@ -39,6 +39,12 @@ SKIP: {
ok( $token = $1, ' Token value is defined' );
ok( $res->[2]->[0] =~ m#<img id="captcha" src="data:image/png;base64#,
' Captcha image inserted' );
ok(
$res->[2]->[0] =~
m#<img class="renewcaptchaclick" src="/static/common/icons/arrow_refresh.png" alt="Renew Captcha" title="Renew Captcha" class="img-thumbnail mb-3" />#,
' Renew Captcha button found'
) or explain( $res->[2]->[0], 'Renew captcha button not found' );
ok( $res->[2]->[0] =~ /captcha\.(?:min\.)?js/, 'Get captcha javascript' );
my @form = ( $res->[2]->[0] =~ m#<form.*?</form>#sg );
ok( @form == 2, 'Display 2 choices' );

View File

@ -6,7 +6,7 @@ require 't/test-lib.pm';
my $res;
my $maintests = 25;
my $maintests = 26;
SKIP: {
eval 'use GD::SecurityImage;use Image::Magick;';
if ($@) {
@ -114,9 +114,10 @@ m%<input name="password" type="text" class="form-control key" autocomplete="off"
' New captcha image inserted' );
ok(
$res->[2]->[0] =~
m#<img class="renewcaptchaclic" src="/static/common/icons/arrow_refresh.png" alt="Renew Captcha" title="Renew Captcha" class="img-thumbnail mb-3" />#,
m#<img class="renewcaptchaclick" src="/static/common/icons/arrow_refresh.png" alt="Renew Captcha" title="Renew Captcha" class="img-thumbnail mb-3" />#,
' Renew Captcha button found'
) or explain( $res->[2]->[0], 'Renew captcha button not found' );
ok( $res->[2]->[0] =~ /captcha\.(?:min\.)?js/, 'Get captcha javascript' );
# Try to renew captcha
ok( $res = $client->_get( '/renewcaptcha', accept => 'text/html' ),

View File

@ -9,7 +9,7 @@ BEGIN {
};
}
my $maintests = 26;
my $maintests = 28;
my ( $res, $user, $pwd, $host, $url, $query );
my $mailSend = 0;
@ -60,6 +60,12 @@ s/^.*token=([^&]+).*$/token=$1&firstname=who&lastname=doctor&mail=dwho%40badwolf
$res->[2]->[0] =~ m%<img src="/static/common/logos/logo_llng_old.png"%,
'Found custom Main Logo'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
m#<img class="renewcaptchaclick" src="/static/common/icons/arrow_refresh.png" alt="Renew Captcha" title="Renew Captcha" class="img-thumbnail mb-3" />#,
' Renew Captcha button found'
) or explain( $res->[2]->[0], 'Renew captcha button not found' );
ok( $res->[2]->[0] =~ /captcha\.(?:min\.)?js/, 'Get captcha javascript' );
$query .= "&captcha=$captcha";

View File

@ -10,7 +10,7 @@ BEGIN {
}
my ( $res, $host, $url, $query );
my $maintests = 14;
my $maintests = 16;
my $mailSend = 0;
my $mail2 = 0;
@ -67,6 +67,12 @@ m%<a class="btn btn-secondary" href="http://auth.example.com/resetpwd\?skin=boot
$res->[2]->[0] =~ m%<img src="/static/common/logos/logo_llng_old.png"%,
'Found custom Main Logo'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
m#<img class="renewcaptchaclick" src="/static/common/icons/arrow_refresh.png" alt="Renew Captcha" title="Renew Captcha" class="img-thumbnail mb-3" />#,
' Renew Captcha button found'
) or explain( $res->[2]->[0], 'Renew captcha button not found' );
ok( $res->[2]->[0] =~ /captcha\.(?:min\.)?js/, 'Get captcha javascript' );
$query .= "&captcha=$captcha";