From 821baa4e7b8660243561299c8400a51abe8fabf4 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 2 Apr 2019 11:30:51 +0100 Subject: [PATCH] Give tests config with default config values --- synapse/crypto/context_factory.py | 1 - tests/http/federation/test_matrix_federation_agent.py | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/synapse/crypto/context_factory.py b/synapse/crypto/context_factory.py index a9561ac0b7..9d890ae890 100644 --- a/synapse/crypto/context_factory.py +++ b/synapse/crypto/context_factory.py @@ -149,7 +149,6 @@ class ClientTLSOptionsFactory(object): # Check if certificate verification has been enabled if (self._config.federation_verify_certificates and - self._config.federation_certificate_validation_whitelist and host not in self._config.federation_certificate_validation_whitelist): # Require verification return ClientTLSOptions(host, self._options_validate._makeContext()) diff --git a/tests/http/federation/test_matrix_federation_agent.py b/tests/http/federation/test_matrix_federation_agent.py index dcf184d3cf..0e732580cc 100644 --- a/tests/http/federation/test_matrix_federation_agent.py +++ b/tests/http/federation/test_matrix_federation_agent.py @@ -49,11 +49,16 @@ class MatrixFederationAgentTests(TestCase): self.mock_resolver = Mock() + config = Mock() + config.federation_custom_ca_list = None + config.federation_verify_certificates = False + config.federation_certificate_validation_whitelist = [] + self.well_known_cache = TTLCache("test_cache", timer=self.reactor.seconds) self.agent = MatrixFederationAgent( reactor=self.reactor, - tls_client_options_factory=ClientTLSOptionsFactory(None), + tls_client_options_factory=ClientTLSOptionsFactory(config), _well_known_tls_policy=TrustingTLSPolicyForHTTPS(), _srv_resolver=self.mock_resolver, _well_known_cache=self.well_known_cache,