Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
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
Maunium
synapse
Commits
6ff34e00
Unverified
Commit
6ff34e00
authored
4 years ago
by
Patrick Cloke
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Skip the SAML tests if xmlsec1 isn't available. (#8905)
parent
43bf3c51
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/8905.misc
+1
-0
1 addition, 0 deletions
changelog.d/8905.misc
tests/handlers/test_saml.py
+23
-0
23 additions, 0 deletions
tests/handlers/test_saml.py
with
24 additions
and
0 deletions
changelog.d/8905.misc
0 → 100644
+
1
−
0
View file @
6ff34e00
Skip the SAML tests if the requirements (`pysaml2` and `xmlsec1`) aren't available.
This diff is collapsed.
Click to expand it.
tests/handlers/test_saml.py
+
23
−
0
View file @
6ff34e00
...
@@ -19,6 +19,24 @@ from synapse.handlers.sso import MappingException
...
@@ -19,6 +19,24 @@ from synapse.handlers.sso import MappingException
from
tests.unittest
import
HomeserverTestCase
,
override_config
from
tests.unittest
import
HomeserverTestCase
,
override_config
# Check if we have the dependencies to run the tests.
try
:
import
saml2.config
from
saml2.sigver
import
SigverError
has_saml2
=
True
# pysaml2 can be installed and imported, but might not be able to find xmlsec1.
config
=
saml2
.
config
.
SPConfig
()
try
:
config
.
load
({
"
metadata
"
:
{}})
has_xmlsec1
=
True
except
SigverError
:
has_xmlsec1
=
False
except
ImportError
:
has_saml2
=
False
has_xmlsec1
=
False
# These are a few constants that are used as config parameters in the tests.
# These are a few constants that are used as config parameters in the tests.
BASE_URL
=
"
https://synapse/
"
BASE_URL
=
"
https://synapse/
"
...
@@ -86,6 +104,11 @@ class SamlHandlerTestCase(HomeserverTestCase):
...
@@ -86,6 +104,11 @@ class SamlHandlerTestCase(HomeserverTestCase):
return
hs
return
hs
if
not
has_saml2
:
skip
=
"
Requires pysaml2
"
elif
not
has_xmlsec1
:
skip
=
"
Requires xmlsec1
"
def
test_map_saml_response_to_user
(
self
):
def
test_map_saml_response_to_user
(
self
):
"""
Ensure that mapping the SAML response returned from a provider to an MXID works properly.
"""
"""
Ensure that mapping the SAML response returned from a provider to an MXID works properly.
"""
saml_response
=
FakeAuthnResponse
({
"
uid
"
:
"
test_user
"
,
"
username
"
:
"
test_user
"
})
saml_response
=
FakeAuthnResponse
({
"
uid
"
:
"
test_user
"
,
"
username
"
:
"
test_user
"
})
...
...
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