summary refs log tree commit diff
path: root/tests/api/test_auth.py
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-09 10:41:43 +0000
committerGitHub <noreply@github.com>2018-08-09 10:41:43 +0000
commit0ad98e38d0c5f6fde18032551cccb291659b9204 (patch)
tree925f1657770ba47599169763dc1be02b6156923d /tests/api/test_auth.py
parentMerge branch 'master' into develop (diff)
parentfix pep8 too many lines (diff)
downloadsynapse-0ad98e38d0c5f6fde18032551cccb291659b9204.tar.xz
Merge pull request #3655 from matrix-org/neilj/disable_hs
Flag to disable HS without disabling federation
Diffstat (limited to 'tests/api/test_auth.py')
-rw-r--r--tests/api/test_auth.py11
1 files changed, 10 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)