summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorNeil Johnson <neil@fragile.org.uk>2018-08-04 22:07:04 +0100
committerNeil Johnson <neil@fragile.org.uk>2018-08-04 22:07:04 +0100
commit42c6823827a12cdb4374bc6e64d32d4ce4f526ec (patch)
treea0dbc9edfea7853ee1631a740a2b3ba085660841 /tests
parentpy3 fix (diff)
downloadsynapse-42c6823827a12cdb4374bc6e64d32d4ce4f526ec.tar.xz
disable HS from config
Diffstat (limited to 'tests')
-rw-r--r--tests/api/test_auth.py11
-rw-r--r--tests/utils.py2
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py
index 5dc3398300..fbb96361a8 100644
--- a/tests/api/test_auth.py
+++ b/tests/api/test_auth.py
@@ -21,7 +21,7 @@ from twisted.internet import defer
 
 import synapse.handlers.auth
 from synapse.api.auth import Auth
-from synapse.api.errors import AuthError
+from synapse.api.errors import AuthError, Codes
 from synapse.types import UserID
 
 from tests import unittest
@@ -469,3 +469,12 @@ class AuthTestCase(unittest.TestCase):
             return_value=defer.succeed(small_number_of_users)
         )
         yield self.auth.check_auth_blocking()
+
+    @defer.inlineCallbacks
+    def test_hs_disabled(self):
+        self.hs.config.hs_disabled = True
+        self.hs.config.hs_disabled_message = "Reason for being disabled"
+        with self.assertRaises(AuthError) as e:
+            yield self.auth.check_auth_blocking()
+        self.assertEquals(e.exception.errcode, Codes.HS_DISABLED)
+        self.assertEquals(e.exception.code, 403)
diff --git a/tests/utils.py b/tests/utils.py
index ec40428e74..a0aa38d264 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -74,6 +74,8 @@ def setup_test_homeserver(name="test", datastore=None, config=None, reactor=None
         config.media_storage_providers = []
         config.auto_join_rooms = []
         config.limit_usage_by_mau = False
+        config.hs_disabled = False
+        config.hs_disabled_message = ""
 
         # disable user directory updates, because they get done in the
         # background, which upsets the test runner.