From 7d346c8106555a856027f281edbd167be1f93151 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 17 Jan 2020 14:39:57 +0000 Subject: [PATCH] remove test dependency on xmlsec Stub things out so that we don't have to have xmlsec installed to run the tests --- tests/test_attributes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_attributes.py b/tests/test_attributes.py index 2aec556..f99fada 100644 --- a/tests/test_attributes.py +++ b/tests/test_attributes.py @@ -20,7 +20,7 @@ import unittest import pkg_resources from saml2.config import SPConfig from saml2.response import AuthnResponse -from saml2.sigver import security_context +from saml2.sigver import CryptoBackend, SecurityContext from synapse.api.errors import RedirectException @@ -39,6 +39,10 @@ class FakeResponse: self.ava["displayName"] = [display_name] +class FakeCryptoBackend(CryptoBackend): + pass + + def _load_test_response() -> AuthnResponse: response_xml = pkg_resources.resource_string( "tests", "test_saml_response.xml" @@ -49,7 +53,7 @@ def _load_test_response() -> AuthnResponse: assert config.attribute_converters is not None response = AuthnResponse( - sec_context=security_context(config), + sec_context=SecurityContext(FakeCryptoBackend()), attribute_converters=config.attribute_converters, entity_id="https://host/_matrix/saml2/metadata.xml", allow_unsolicited=True,