summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-02-11 22:01:27 +0000
committerRichard van der Hoff <richard@matrix.org>2019-02-11 22:01:27 +0000
commit0ca290865350212e1834730c918973162a3067f4 (patch)
tree9aecae58476c7fa957324ea960bdcc4a24158c59
parentInfer no_tls from presence of TLS listeners (diff)
downloadsynapse-0ca290865350212e1834730c918973162a3067f4.tar.xz
fix tests
-rw-r--r--synapse/config/tls.py2
-rw-r--r--tests/config/test_tls.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/synapse/config/tls.py b/synapse/config/tls.py
index e37a41eff4..86e6eb80db 100644
--- a/synapse/config/tls.py
+++ b/synapse/config/tls.py
@@ -111,7 +111,7 @@ class TlsConfig(Config):
         """
         self.tls_certificate = self.read_tls_certificate()
 
-        if not self.no_tls:
+        if self.has_tls_listener():
             self.tls_private_key = self.read_tls_private_key()
 
         self.tls_fingerprints = list(self._original_tls_fingerprints)
diff --git a/tests/config/test_tls.py b/tests/config/test_tls.py
index 4ccaf35603..d8fd18a9cb 100644
--- a/tests/config/test_tls.py
+++ b/tests/config/test_tls.py
@@ -20,6 +20,11 @@ from synapse.config.tls import TlsConfig
 from tests.unittest import TestCase
 
 
+class TestConfig(TlsConfig):
+    def has_tls_listener(self):
+        return False
+
+
 class TLSConfigTests(TestCase):
 
     def test_warn_self_signed(self):
@@ -55,11 +60,10 @@ s4niecZKPBizL6aucT59CsunNmmb5Glq8rlAcU+1ZTZZzGYqVYhF6axB9Qg=
 
         config = {
             "tls_certificate_path": os.path.join(config_dir, "cert.pem"),
-            "no_tls": True,
             "tls_fingerprints": []
         }
 
-        t = TlsConfig()
+        t = TestConfig()
         t.read_config(config)
         t.read_certificate_from_disk()