summary refs log tree commit diff
path: root/tests/handlers/test_sync.py
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-09 12:26:27 +0100
committerNeil Johnson <neil@matrix.org>2018-08-09 12:26:27 +0100
commit69ce057ea613f425d5ef6ace03d0019a8e4fdf49 (patch)
treeefb1f69d1b390217d85ca35ea80ef134c978b143 /tests/handlers/test_sync.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into neilj/mau_sync_b... (diff)
downloadsynapse-69ce057ea613f425d5ef6ace03d0019a8e4fdf49.tar.xz
block sync if auth checks fail
Diffstat (limited to 'tests/handlers/test_sync.py')
-rw-r--r--tests/handlers/test_sync.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/handlers/test_sync.py b/tests/handlers/test_sync.py
index 3b1b4d4923..497e4bd933 100644
--- a/tests/handlers/test_sync.py
+++ b/tests/handlers/test_sync.py
@@ -14,11 +14,14 @@
 # limitations under the License.
 from twisted.internet import defer
 
+from synapse.api.errors import AuthError
+from synapse.api.filtering import DEFAULT_FILTER_COLLECTION
+from synapse.handlers.sync import SyncConfig, SyncHandler
+from synapse.types import UserID
+
 import tests.unittest
 import tests.utils
 from tests.utils import setup_test_homeserver
-from synapse.handlers.sync import SyncHandler, SyncConfig
-from synapse.types import UserID
 
 
 class SyncTestCase(tests.unittest.TestCase):
@@ -32,11 +35,15 @@ class SyncTestCase(tests.unittest.TestCase):
     @defer.inlineCallbacks
     def test_wait_for_sync_for_user_auth_blocking(self):
         sync_config = SyncConfig(
-            user=UserID("@user","server"),
-            filter_collection=None,
+            user=UserID("@user", "server"),
+            filter_collection=DEFAULT_FILTER_COLLECTION,
             is_guest=False,
             request_key="request_key",
             device_id="device_id",
         )
-        res = yield self.sync_handler.wait_for_sync_for_user(sync_config)
-        print res
+        # Ensure that an exception is not thrown
+        yield self.sync_handler.wait_for_sync_for_user(sync_config)
+        self.hs.config.hs_disabled = True
+
+        with self.assertRaises(AuthError):
+            yield self.sync_handler.wait_for_sync_for_user(sync_config)