Improve unit tests (#1515)
This commit is contained in:
parent
799e6cfa3c
commit
52ac044205
|
@ -54,7 +54,7 @@ SKIP: {
|
|||
ok( $ts = getCache()->get($token), ' Found token session' );
|
||||
$ts = eval { JSON::from_json($ts) };
|
||||
ok( $captcha = $ts->{captcha}, ' Found captcha value' );
|
||||
ok( $res->[2]->[0] =~ qr%<img src="/static/common/logos/logo_llng_old.png"%,
|
||||
ok( $res->[2]->[0] =~ m%<img src="/static/common/logos/logo_llng_old.png"%,
|
||||
'Found custom Main Logo' )
|
||||
or print STDERR Dumper( $res->[2]->[0] );
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
my ( $res, $host, $url, $query );
|
||||
my $maintests = 11;
|
||||
my $maintests = 12;
|
||||
my $mailSend = 0;
|
||||
my $mail2 = 0;
|
||||
|
||||
|
@ -32,7 +32,7 @@ SKIP: {
|
|||
captcha_mail_enabled => 1,
|
||||
requireToken => 1,
|
||||
portalDisplayResetPassword => 1,
|
||||
portalMainLogo => 'common/logos/logo_llng_old.png',
|
||||
portalMainLogo => 'common/logos/logo_llng_old.png',
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -57,9 +57,10 @@ SKIP: {
|
|||
ok( $ts = getCache()->get($token), ' Found token session' );
|
||||
$ts = eval { JSON::from_json($ts) };
|
||||
ok( $captcha = $ts->{captcha}, ' Found captcha value' );
|
||||
ok( $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]
|
||||
=~ m%<img src="/static/common/logos/logo_llng_old.png"%,
|
||||
'Found custom Main Logo'
|
||||
) or print STDERR Dumper( $res->[2]->[0] );
|
||||
|
||||
$query .= "&captcha=$captcha";
|
||||
|
||||
|
@ -71,6 +72,9 @@ SKIP: {
|
|||
),
|
||||
'Post mail'
|
||||
);
|
||||
ok( mail() =~ m%Content-Type: image/png; name="logo_llng_old.png"%,
|
||||
'Found custom Main logo in mail' )
|
||||
or print STDERR Dumper( mail() );
|
||||
|
||||
ok( mail() =~ m#a href="http://auth.example.com/resetpwd\?(.*?)"#,
|
||||
'Found link in mail' );
|
||||
|
|
|
@ -10,21 +10,20 @@ BEGIN {
|
|||
}
|
||||
|
||||
my ( $res, $user, $pwd );
|
||||
my $maintests = 7;
|
||||
my $maintests = 9;
|
||||
my $mailSend = 0;
|
||||
|
||||
my $mail2 = 0;
|
||||
|
||||
SKIP: {
|
||||
eval
|
||||
'require Email::Sender::Simple;use GD::SecurityImage;use Image::Magick;';
|
||||
'require Email::Sender::Simple;use GD::SecurityImage;use Image::Magick;';
|
||||
if ($@) {
|
||||
skip 'Missing dependencies', $maintests;
|
||||
}
|
||||
|
||||
my $client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
{ ini => {
|
||||
logLevel => 'error',
|
||||
useSafeJail => 1,
|
||||
portalDisplayRegister => 1,
|
||||
|
@ -34,6 +33,7 @@ SKIP: {
|
|||
captcha_mail_enabled => 0,
|
||||
requireToken => 1,
|
||||
portalDisplayResetPassword => 1,
|
||||
portalMainLogo => 'common/logos/logo_llng_old.png',
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -42,29 +42,36 @@ SKIP: {
|
|||
# ------------------------
|
||||
ok( $res = $client->_get( '/resetpwd', accept => 'text/html' ),
|
||||
'Reset form', );
|
||||
my ( $host, $url, $query ) =
|
||||
expectForm( $res, '#', undef, 'mail', 'token' );
|
||||
my ( $host, $url, $query )
|
||||
= expectForm( $res, '#', undef, 'mail', 'token' );
|
||||
|
||||
$query =~ s/mail=&//;
|
||||
$query .= '&mail=dwho%40badwolf.org';
|
||||
|
||||
# Post email
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
ok( $res = $client->_post(
|
||||
'/resetpwd', IO::String->new($query),
|
||||
length => length($query),
|
||||
accept => 'text/html'
|
||||
),
|
||||
'Post mail'
|
||||
);
|
||||
|
||||
ok( $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( mail() =~ m%Content-Type: image/png; name="logo_llng_old.png"%,
|
||||
'Found custom Main logo in mail' )
|
||||
or print STDERR Dumper( mail() );
|
||||
ok( mail() =~ m#a href="http://auth.example.com/resetpwd\?(.*?)"#,
|
||||
'Found link in mail' );
|
||||
$query = $1;
|
||||
|
||||
ok(
|
||||
$res =
|
||||
$client->_get( '/resetpwd', query => $query, accept => 'text/html' ),
|
||||
ok( $res = $client->_get(
|
||||
'/resetpwd',
|
||||
query => $query,
|
||||
accept => 'text/html'
|
||||
),
|
||||
'Post mail token received by mail'
|
||||
);
|
||||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'token' );
|
||||
|
@ -73,8 +80,7 @@ SKIP: {
|
|||
$query .= '&newpassword=zz&confirmpassword=zz';
|
||||
|
||||
# Post new password
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
ok( $res = $client->_post(
|
||||
'/resetpwd', IO::String->new($query),
|
||||
length => length($query),
|
||||
accept => 'text/html'
|
||||
|
|
|
@ -10,21 +10,20 @@ BEGIN {
|
|||
}
|
||||
|
||||
my ( $res, $user, $pwd );
|
||||
my $maintests = 7;
|
||||
my $maintests = 9;
|
||||
my $mailSend = 0;
|
||||
|
||||
my $mail2 = 0;
|
||||
|
||||
SKIP: {
|
||||
eval
|
||||
'require Email::Sender::Simple;use GD::SecurityImage;use Image::Magick;';
|
||||
'require Email::Sender::Simple;use GD::SecurityImage;use Image::Magick;';
|
||||
if ($@) {
|
||||
skip 'Missing dependencies', $maintests;
|
||||
}
|
||||
|
||||
my $client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
{ ini => {
|
||||
logLevel => 'error',
|
||||
useSafeJail => 1,
|
||||
portalDisplayRegister => 1,
|
||||
|
@ -33,6 +32,7 @@ SKIP: {
|
|||
passwordDB => 'Demo',
|
||||
captcha_mail_enabled => 0,
|
||||
portalDisplayResetPassword => 1,
|
||||
portalMainLogo => 'common/logos/logo_llng_old.png',
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -46,22 +46,29 @@ SKIP: {
|
|||
$query = 'mail=dwho%40badwolf.org';
|
||||
|
||||
# Post email
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
ok( $res = $client->_post(
|
||||
'/resetpwd', IO::String->new($query),
|
||||
length => length($query),
|
||||
accept => 'text/html'
|
||||
),
|
||||
'Post mail'
|
||||
);
|
||||
ok( $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( mail() =~ m%Content-Type: image/png; name="logo_llng_old.png"%,
|
||||
'Found custom Main logo in mail' )
|
||||
or print STDERR Dumper( mail() );
|
||||
ok( mail() =~ m#a href="http://auth.example.com/resetpwd\?(.*?)"#,
|
||||
'Found link in mail' );
|
||||
$query = $1;
|
||||
|
||||
ok(
|
||||
$res =
|
||||
$client->_get( '/resetpwd', query => $query, accept => 'text/html' ),
|
||||
ok( $res = $client->_get(
|
||||
'/resetpwd',
|
||||
query => $query,
|
||||
accept => 'text/html'
|
||||
),
|
||||
'Post mail token received by mail'
|
||||
);
|
||||
( $host, $url, $query ) = expectForm( $res, '#', undef, 'token' );
|
||||
|
@ -70,8 +77,7 @@ SKIP: {
|
|||
$query .= '&newpassword=zz&confirmpassword=zz';
|
||||
|
||||
# Post new password
|
||||
ok(
|
||||
$res = $client->_post(
|
||||
ok( $res = $client->_post(
|
||||
'/resetpwd', IO::String->new($query),
|
||||
length => length($query),
|
||||
accept => 'text/html'
|
||||
|
|
Loading…
Reference in New Issue
Block a user