Commit 7b064542 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Improve unit test (#2019)

parent 9a865598
...@@ -5,7 +5,7 @@ use strict; ...@@ -5,7 +5,7 @@ use strict;
require 't/test-lib.pm'; require 't/test-lib.pm';
my $res; my $res;
my $maintests = 14; my $maintests = 16;
SKIP: { SKIP: {
eval 'use GD::SecurityImage;use Image::Magick;'; eval 'use GD::SecurityImage;use Image::Magick;';
if ($@) { if ($@) {
...@@ -39,6 +39,12 @@ SKIP: { ...@@ -39,6 +39,12 @@ SKIP: {
ok( $token = $1, ' Token value is defined' ); ok( $token = $1, ' Token value is defined' );
ok( $res->[2]->[0] =~ m#<img id="captcha" src="data:image/png;base64#, ok( $res->[2]->[0] =~ m#<img id="captcha" src="data:image/png;base64#,
' Captcha image inserted' ); ' 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 ); my @form = ( $res->[2]->[0] =~ m#<form.*?</form>#sg );
ok( @form == 2, 'Display 2 choices' ); ok( @form == 2, 'Display 2 choices' );
......
...@@ -6,7 +6,7 @@ require 't/test-lib.pm'; ...@@ -6,7 +6,7 @@ require 't/test-lib.pm';
my $res; my $res;
my $maintests = 25; my $maintests = 26;
SKIP: { SKIP: {
eval 'use GD::SecurityImage;use Image::Magick;'; eval 'use GD::SecurityImage;use Image::Magick;';
if ($@) { if ($@) {
...@@ -114,9 +114,10 @@ m%<input name="password" type="text" class="form-control key" autocomplete="off" ...@@ -114,9 +114,10 @@ m%<input name="password" type="text" class="form-control key" autocomplete="off"
' New captcha image inserted' ); ' New captcha image inserted' );
ok( ok(
$res->[2]->[0] =~ $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' ' Renew Captcha button found'
) or explain( $res->[2]->[0], 'Renew captcha button not 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 # Try to renew captcha
ok( $res = $client->_get( '/renewcaptcha', accept => 'text/html' ), ok( $res = $client->_get( '/renewcaptcha', accept => 'text/html' ),
......
...@@ -9,7 +9,7 @@ BEGIN { ...@@ -9,7 +9,7 @@ BEGIN {
}; };
} }
my $maintests = 26; my $maintests = 28;
my ( $res, $user, $pwd, $host, $url, $query ); my ( $res, $user, $pwd, $host, $url, $query );
my $mailSend = 0; my $mailSend = 0;
...@@ -60,6 +60,12 @@ s/^.*token=([^&]+).*$/token=$1&firstname=who&lastname=doctor&mail=dwho%40badwolf ...@@ -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"%, $res->[2]->[0] =~ m%<img src="/static/common/logos/logo_llng_old.png"%,
'Found custom Main Logo' 'Found custom Main Logo'
) or print STDERR Dumper( $res->[2]->[0] ); ) 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"; $query .= "&captcha=$captcha";
......
...@@ -10,7 +10,7 @@ BEGIN { ...@@ -10,7 +10,7 @@ BEGIN {
} }
my ( $res, $host, $url, $query ); my ( $res, $host, $url, $query );
my $maintests = 14; my $maintests = 16;
my $mailSend = 0; my $mailSend = 0;
my $mail2 = 0; my $mail2 = 0;
...@@ -67,6 +67,12 @@ m%<a class="btn btn-secondary" href="http://auth.example.com/resetpwd\?skin=boot ...@@ -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"%, $res->[2]->[0] =~ m%<img src="/static/common/logos/logo_llng_old.png"%,
'Found custom Main Logo' 'Found custom Main Logo'
) or print STDERR Dumper( $res->[2]->[0] ); ) 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"; $query .= "&captcha=$captcha";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment