Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Xavier Bachelot
lemonldap-ng
Commits
7b064542
Commit
7b064542
authored
Dec 28, 2019
by
Christophe Maudoux
🐛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve unit test (#2019)
parent
9a865598
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
5 deletions
+24
-5
lemonldap-ng-portal/t/28-AuthChoice-with-captcha.t
lemonldap-ng-portal/t/28-AuthChoice-with-captcha.t
+7
-1
lemonldap-ng-portal/t/41-Captcha.t
lemonldap-ng-portal/t/41-Captcha.t
+3
-2
lemonldap-ng-portal/t/42-Register-Demo-with-captcha.t
lemonldap-ng-portal/t/42-Register-Demo-with-captcha.t
+7
-1
lemonldap-ng-portal/t/43-MailPasswordReset-with-captcha.t
lemonldap-ng-portal/t/43-MailPasswordReset-with-captcha.t
+7
-1
No files found.
lemonldap-ng-portal/t/28-AuthChoice-with-captcha.t
View file @
7b064542
...
...
@@ -5,7 +5,7 @@ use strict;
require
'
t/test-lib.pm
';
my
$res
;
my
$maintests
=
1
4
;
my
$maintests
=
1
6
;
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
'
);
...
...
lemonldap-ng-portal/t/41-Captcha.t
View file @
7b064542
...
...
@@ -6,7 +6,7 @@ require 't/test-lib.pm';
my
$res
;
my
$maintests
=
2
5
;
my
$maintests
=
2
6
;
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="renewcaptchaclic
k
" 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
'
),
...
...
lemonldap-ng-portal/t/42-Register-Demo-with-captcha.t
View file @
7b064542
...
...
@@ -9,7 +9,7 @@ BEGIN {
};
}
my
$maintests
=
2
6
;
my
$maintests
=
2
8
;
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
";
...
...
lemonldap-ng-portal/t/43-MailPasswordReset-with-captcha.t
View file @
7b064542
...
...
@@ -10,7 +10,7 @@ BEGIN {
}
my
(
$res
,
$host
,
$url
,
$query
);
my
$maintests
=
1
4
;
my
$maintests
=
1
6
;
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
";
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment