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
61866cf4
Commit
61866cf4
authored
7 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
initial import
parent
22715220
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/samlmetadata.t
+76
-0
76 additions, 0 deletions
t/samlmetadata.t
with
76 additions
and
0 deletions
t/samlmetadata.t
0 → 100644
+
76
−
0
View file @
61866cf4
#!/usr/bin/perl
use
strict
;
use
warnings
;
use
English
qw(-no_match_vars)
;
use
File::
Temp
;
use
Test::
More
;
use
Test::
Exception
;
use
IdPAccountManager::
SAMLMetadata
;
plan
tests
=>
6
;
my
$metadata
;
throws_ok
{
$metadata
=
IdPAccountManager::
SAMLMetadata
->
new
();
}
qr/^missing argument 'file'/
,
'
instanciation: no file argument
';
throws_ok
{
$metadata
=
IdPAccountManager::
SAMLMetadata
->
new
(
file
=>
'
/no/such/file
',
);
}
qr/^non-existing file/
,
'
instanciation: non-existing file argument
';
my
$file1
=
File::
Temp
->
new
(
UNLINK
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
chmod
0000
,
$file1
;
throws_ok
{
$metadata
=
IdPAccountManager::
SAMLMetadata
->
new
(
file
=>
$file1
->
filename
()
);
}
qr/^non-readable file/
,
'
instanciation: non-readable file
';
chmod
0644
,
$file1
;
throws_ok
{
$metadata
=
IdPAccountManager::
SAMLMetadata
->
new
(
file
=>
$file1
->
filename
()
);
}
qr/^Failed to parse file \S+: Empty Stream/
,
'
instanciation: empty file
';
my
$file2
=
File::
Temp
->
new
(
UNLINK
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
print
$file2
<<EOF;
foo
EOF
close
(
$file2
);
throws_ok
{
$metadata
=
IdPAccountManager::
SAMLMetadata
->
new
(
file
=>
$file2
->
filename
()
);
}
qr/^Failed to parse file \S+: Entity: line 1: parser error/
,
'
instanciation: non-xml file
';
my
$file3
=
File::
Temp
->
new
(
UNLINK
=>
$ENV
{
TEST_DEBUG
}
?
0
:
1
);
print
$file3
<<EOF;
<?xml version="1.0" encoding="UTF-8" ?>
<root/>
EOF
close
(
$file3
);
throws_ok
{
$metadata
=
IdPAccountManager::
SAMLMetadata
->
new
(
file
=>
$file3
->
filename
()
);
}
qr/^incorrect root element type 'root'/
,
'
instanciation: incorrect xml file
';
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