Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Access Check - Account manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Access Check - Account manager
Commits
9e7fe9cc
Commit
9e7fe9cc
authored
3 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
additional tests
parent
5de664d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
t/app.t
+88
-4
88 additions, 4 deletions
t/app.t
with
88 additions
and
4 deletions
t/app.t
+
88
−
4
View file @
9e7fe9cc
...
...
@@ -12,6 +12,9 @@ use Test::HTML::Tidy5 qw();
use
Test::
More
;
use
Test::Mojo::
WithRoles
'
SubmitForm
';
use
AccountManager::Data::
DB
;
use
AccountManager::Data::
Entity
;
plan
(
skip_all
=>
'
live database required
')
unless
$ENV
{
TEST_DB_HOST
}
&&
$ENV
{
TEST_DB_NAME
}
&&
...
...
@@ -19,7 +22,7 @@ plan(skip_all => 'live database required') unless
$ENV
{
TEST_DB_USERNAME
}
&&
$ENV
{
TEST_DB_PASSWORD
};
plan
tests
=>
4
;
plan
tests
=>
9
;
sub
named_subtest
{
my
(
$name
,
$code
,
@args
)
=
@_
;
...
...
@@ -43,6 +46,27 @@ sub setup {
system
("
mysql --host=
$host
--user=
$username
--password=
$password
$name
< conf/manager.sql
")
==
0
or
die
"
can't run mysql:
$CHILD_ERROR
\n
";
AccountManager::Data::
DB
->
register_db
(
driver
=>
$args
{
type
},
host
=>
$host
,
database
=>
$name
,
password
=>
$password
,
username
=>
$username
,
);
my
$db
=
AccountManager::Data::
DB
->
new
();
my
$entity
=
AccountManager::Data::
Entity
->
new
(
db
=>
$db
,
type
=>
'
sp
',
entityid
=>
'
https://sp.renater.fr/
',
display_name
=>
'
https://sp.renater.fr/ (Test SP)
',
information_url
=>
'
https://sp.renater.fr
',
organization_url
=>
'
http://www.renater.fr
',
contacts
=>
['
contact1@renater.fr
',
'
contact2@renater.fr
'],
federations
=>
['
edugain
'],
);
$entity
->
save
();
my
$temp_dir
=
File::
Temp
->
newdir
(
CLEANUP
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
diag
("
temp dir:
$temp_dir
")
if
$ENV
{
TEST_DEBUG
};
...
...
@@ -160,13 +184,13 @@ named_subtest "SP selection page" => sub {
$t
->
get_ok
('
/step1
')
->
status_is
(
200
)
->
text_is
('
html head title
'
=>
'
eduGAIN Access Check
',
'
expected title
')
->
element_exists
('
select[id=all][name=all]
',
'
SP
lis
t
');
->
element_exists
('
select[id=all][name=all]
',
'
SP
selection widge
t
');
my
$res
=
$t
->
tx
()
->
res
();
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
named_subtest
"
email selection page, missing entityid
parameter
"
=>
sub
{
named_subtest
"
email selection page, missing entityid
"
=>
sub
{
my
$t
=
get_test_object
(
test
=>
$_
[
0
]);
$t
->
get_ok
('
/step2
'
=>
form
=>
{
federation
=>
'
edugain
'})
...
...
@@ -178,7 +202,7 @@ named_subtest "email selection page, missing entityid parameter" => sub {
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
named_subtest
"
email selection page, invalid entityid
parameter
"
=>
sub
{
named_subtest
"
email selection page, invalid entityid
"
=>
sub
{
my
$t
=
get_test_object
(
test
=>
$_
[
0
]);
$t
->
get_ok
('
/step2
'
=>
form
=>
{
federation
=>
'
edugain
',
entityid
=>
'
foo
'})
...
...
@@ -189,3 +213,63 @@ named_subtest "email selection page, invalid entityid parameter" => sub {
my
$res
=
$t
->
tx
()
->
res
();
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
named_subtest
"
email selection page, valid entityid
"
=>
sub
{
my
$t
=
get_test_object
(
test
=>
$_
[
0
]);
$t
->
get_ok
('
/step2
'
=>
form
=>
{
federation
=>
'
edugain
',
entityid
=>
'
https://sp.renater.fr/
'})
->
status_is
(
200
)
->
text_is
('
html head title
'
=>
'
eduGAIN Access Check
',
'
expected title
')
->
element_exists
('
input[name=email][value=contact1@renater.fr]
',
'
email selection widget
');
my
$res
=
$t
->
tx
()
->
res
();
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
named_subtest
"
challenge page, missing entityid
"
=>
sub
{
my
$t
=
get_test_object
(
test
=>
$_
[
0
]);
$t
->
get_ok
('
/step3
'
=>
form
=>
{
federation
=>
'
edugain
'})
->
status_is
(
200
)
->
text_is
('
html head title
'
=>
'
eduGAIN Access Check
',
'
expected title
')
->
content_like
(
qr/Error:[\n\s]+missing parameter 'entityid'/
,
'
expected error message
');
my
$res
=
$t
->
tx
()
->
res
();
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
named_subtest
"
challenge page, invalid entityid
"
=>
sub
{
my
$t
=
get_test_object
(
test
=>
$_
[
0
]);
$t
->
get_ok
('
/step3
'
=>
form
=>
{
federation
=>
'
edugain
',
entityid
=>
'
foo
'})
->
status_is
(
200
)
->
text_is
('
html head title
'
=>
'
eduGAIN Access Check
',
'
expected title
')
->
content_like
(
qr/Error:[\n\s]+invalid parameter 'entityid'/
,
'
expected error message
');
my
$res
=
$t
->
tx
()
->
res
();
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
named_subtest
"
challenge page, valid entityid, missing email
"
=>
sub
{
my
$t
=
get_test_object
(
test
=>
$_
[
0
]);
$t
->
get_ok
('
/step3
'
=>
form
=>
{
federation
=>
'
edugain
',
entityid
=>
'
https://sp.renater.fr/
'})
->
status_is
(
200
)
->
text_is
('
html head title
'
=>
'
eduGAIN Access Check
',
'
expected title
')
->
content_like
(
qr/Error:[\n\s]+missing parameter 'email'/
,
'
expected error message
');
my
$res
=
$t
->
tx
()
->
res
();
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
named_subtest
"
challenge page, valid entityid, invalid email
"
=>
sub
{
my
$t
=
get_test_object
(
test
=>
$_
[
0
]);
$t
->
get_ok
('
/step3
'
=>
form
=>
{
federation
=>
'
edugain
',
entityid
=>
'
https://sp.renater.fr/
',
email
=>
'
foo
'})
->
status_is
(
200
)
->
text_is
('
html head title
'
=>
'
eduGAIN Access Check
',
'
expected title
')
->
content_like
(
qr/Error:[\n\s]+invalid parameter 'email'/
,
'
expected error message
');
my
$res
=
$t
->
tx
()
->
res
();
html_ok
(
$res
)
or
diag_file
(
$res
,
$test_dir
);
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment