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
798e8e3d
Commit
798e8e3d
authored
7 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
really use the generated configuration file
parent
a5b8d903
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
t/account-manager.t
+72
-17
72 additions, 17 deletions
t/account-manager.t
with
72 additions
and
17 deletions
t/account-manager.t
+
72
−
17
View file @
798e8e3d
...
...
@@ -38,9 +38,18 @@ SKIP: {
$ENV
{
TEST_DB_USER
}
&&
$ENV
{
TEST_DB_PASSWORD
};
my
$configuration
=
File::
Temp
->
new
(
UNLINK
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
print
{
$configuration
}
<<EOF;
my
$config_file
=
File::
Temp
->
new
(
UNLINK
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
my
$accounts_file
=
File::
Temp
->
new
(
UNLINK
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
print
{
$config_file
}
<<EOF;
tokens_validity_period = 2
templates_dir = templates
[idp]
accounts_file = $accounts_file
scope = localhost
[service]
account_validity_period = 2
[database]
type = $ENV{TEST_DB_TYPE}
...
...
@@ -49,30 +58,46 @@ name = $ENV{TEST_DB_NAME}
user = $ENV{TEST_DB_USER}
password = $ENV{TEST_DB_PASSWORD}
EOF
$config_file
->
flush
();
# reset database content
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_accounts --delete
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_accounts --delete
"
);
ok
(
$rc
==
0
,
'
delete accounts exit status
');
is
(
$err
,
'',
'
delete accounts stderr output
');
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_tokens --delete
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_tokens --delete
"
);
ok
(
$rc
==
0
,
'
delete tokens exit status
');
is
(
$err
,
'',
'
delete tokens stderr output
');
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_services --delete
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_services --delete
"
);
ok
(
$rc
==
0
,
'
delete services exit status
');
is
(
$err
,
'',
'
delete services stderr output
');
# accounts
# initial list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_accounts
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_accounts
"
);
ok
(
$rc
==
0
,
'
list accounts exit status
');
is
(
$out
,
"
No matching test account in DB
\n
",
'
list accounts stdin output
');
is
(
$err
,
'',
'
list accounts stderr output
');
# creation failure
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
add_account
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
add_account
"
);
ok
(
$rc
==
2
,
'
add account without mandatory option exit status
');
is
(
$out
,
'',
'
add account without mandatory option stdin output
');
like
(
...
...
@@ -82,13 +107,19 @@ EOF
);
# creation success
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
add_account --profile foo --sp_entityid bar
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
add_account --profile foo --sp_entityid bar
"
);
ok
(
$rc
==
0
,
'
add account with mandatory option exit status
');
like
(
$out
,
qr/Account created/
,
'
add account with mandatory option stdin output
');
is
(
$err
,
'',
'
add account with mandatory option stderr output
');
# final list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_accounts
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_accounts
"
);
ok
(
$rc
==
0
,
'
list accounts exit status
');
like
(
$out
,
qr/Account ID=\d+; password_hash=/
,
'
list accounts stdin output
');
is
(
$err
,
'',
'
list accounts stderr output
');
...
...
@@ -96,13 +127,19 @@ EOF
# services
# initial list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_services
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_services
"
);
ok
(
$rc
==
0
,
'
list services exit status
');
is
(
$out
,
"
No service provider in DB
\n
",
'
list services stdin output
');
is
(
$err
,
'',
'
list services stderr output
');
# creation failure
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
add_service
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
add_service
"
);
ok
(
$rc
==
2
,
'
add service without mandatory option exit status
');
is
(
$out
,
'',
'
add service without mandatory option stdin output
');
like
(
...
...
@@ -112,13 +149,19 @@ EOF
);
# creation success
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
add_service --sp_entityid bar --contacts joe,bob
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
add_service --sp_entityid bar --contacts joe,bob
"
);
ok
(
$rc
==
0
,
'
add service with mandatory option exit status
');
like
(
$out
,
qr/Service Provider created/
,
'
add service with mandatory option stdin output
');
is
(
$err
,
'',
'
add service with mandatory option stderr output
');
# final list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_services
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_services
"
);
ok
(
$rc
==
0
,
'
list services exit status
');
like
(
$out
,
qr/Service ID=\d+; entityid=bar; displayname=; contacts=joe,bob/
,
'
list services stdin output
');
is
(
$err
,
'',
'
list services stderr output
');
...
...
@@ -126,13 +169,19 @@ EOF
# tokens
# initial list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_tokens
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_tokens
"
);
ok
(
$rc
==
0
,
'
list tokens exit status
');
is
(
$out
,
"
No corresponding token found in DB
\n
",
'
list tokens stdin output
');
is
(
$err
,
'',
'
list tokens stderr output
');
# creation failure
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
add_token
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
add_token
"
);
ok
(
$rc
==
2
,
'
add token without mandatory option exit status
');
is
(
$out
,
'',
'
add token without mandatory option stdin output
');
like
(
...
...
@@ -142,13 +191,19 @@ EOF
);
# creation success
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
add_token --sp_entityid bar --email_address joe
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
add_token --sp_entityid bar --email_address joe
"
);
ok
(
$rc
==
0
,
'
add token with mandatory option exit status
');
like
(
$out
,
qr/Authentication token created/
,
'
add token with mandatory option stdin output
');
is
(
$err
,
'',
'
add token with mandatory option stderr output
');
# final list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
list_tokens
');
(
$out
,
$err
,
$rc
)
=
run_executable
(
'
account-manager.pl
',
"
--config
$config_file
list_tokens
"
);
ok
(
$rc
==
0
,
'
list tokens exit status
');
like
(
$out
,
qr/Token ID=\d+; token=\w+; email_address=joe; sp_entityid=bar/
,
'
list tokens stdin output
');
is
(
$err
,
'',
'
list tokens stderr output
');
...
...
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