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
9b452738
Commit
9b452738
authored
7 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
add a bunch of live object creation tests
parent
2803a3da
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/account-manager.t
+124
-1
124 additions, 1 deletion
t/account-manager.t
with
124 additions
and
1 deletion
t/account-manager.t
+
124
−
1
View file @
9b452738
...
...
@@ -4,10 +4,11 @@ use strict;
use
warnings
;
use
English
qw(-no_match_vars)
;
use
File::
Temp
;
use
IPC::
Run
qw(run)
;
use
Test::
More
;
plan
tests
=>
6
;
plan
tests
=>
48
;
my
(
$out
,
$err
,
$rc
);
...
...
@@ -29,6 +30,128 @@ like(
);
is
(
$out
,
'',
'
no action stdout
');
SKIP:
{
skip
'
live database required
',
15
unless
$ENV
{
TEST_DB_TYPE
}
&&
$ENV
{
TEST_DB_HOST
}
&&
$ENV
{
TEST_DB_NAME
}
&&
$ENV
{
TEST_DB_USER
}
&&
$ENV
{
TEST_DB_PASSWORD
};
my
$configuration
=
File::
Temp
->
new
(
UNLINK
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
print
{
$configuration
}
<<EOF;
[database]
type = $ENV{TEST_DB_TYPE}
host = $ENV{TEST_DB_HOST}
name = $ENV{TEST_DB_NAME}
user = $ENV{TEST_DB_USER}
password = $ENV{TEST_DB_PASSWORD}
EOF
# reset database content
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
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
');
ok
(
$rc
==
0
,
'
delete tokens exit status
');
is
(
$err
,
'',
'
delete tokens stderr output
');
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
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
');
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
');
ok
(
$rc
==
2
,
'
add account without mandatory option exit status
');
is
(
$out
,
'',
'
add account without mandatory option stdin output
');
like
(
$err
,
qr/missing profile option, aborting/
,
'
add account without mandatory option stderr output
'
);
# creation success
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
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
');
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
');
# services
# initial list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
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
');
ok
(
$rc
==
2
,
'
add service without mandatory option exit status
');
is
(
$out
,
'',
'
add service without mandatory option stdin output
');
like
(
$err
,
qr/missing sp_entityid option, aborting/
,
'
add service without mandatory option stderr output
'
);
# creation success
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
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
');
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
');
# tokens
# initial list
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
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
');
ok
(
$rc
==
2
,
'
add token without mandatory option exit status
');
is
(
$out
,
'',
'
add token without mandatory option stdin output
');
like
(
$err
,
qr/missing email_address option, aborting/
,
'
add token without mandatory option stderr output
'
);
# creation success
(
$out
,
$err
,
$rc
)
=
run_executable
('
account-manager.pl
',
'
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
');
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
');
}
sub
run_executable
{
my
(
$executable
,
$args
)
=
@_
;
...
...
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