summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-09-07 02:58:18 +1000
committerGitHub <noreply@github.com>2018-09-07 02:58:18 +1000
commit52ec6e9dfad5e088f000d20cbb4a1bbc8008c00d (patch)
treec146b5df538580374b1412454af34eb99faae4ec /tests/utils.py
parentMerge pull request #3800 from matrix-org/neilj/remove-guests-from-mau-count (diff)
downloadsynapse-52ec6e9dfad5e088f000d20cbb4a1bbc8008c00d.tar.xz
Port tests/ to Python 3 (#3808)
Diffstat (limited to '')
-rw-r--r--tests/utils.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 91173fa45d..215226debf 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -100,8 +100,13 @@ class TestHomeServer(HomeServer):
 
 @defer.inlineCallbacks
 def setup_test_homeserver(
-    cleanup_func, name="test", datastore=None, config=None, reactor=None,
-    homeserverToUse=TestHomeServer, **kargs
+    cleanup_func,
+    name="test",
+    datastore=None,
+    config=None,
+    reactor=None,
+    homeserverToUse=TestHomeServer,
+    **kargs
 ):
     """
     Setup a homeserver suitable for running tests against.  Keyword arguments
@@ -323,8 +328,7 @@ class MockHttpResource(HttpServer):
     @patch('twisted.web.http.Request')
     @defer.inlineCallbacks
     def trigger(
-        self, http_method, path, content, mock_request,
-        federation_auth_origin=None,
+        self, http_method, path, content, mock_request, federation_auth_origin=None
     ):
         """ Fire an HTTP event.
 
@@ -357,7 +361,7 @@ class MockHttpResource(HttpServer):
         headers = {}
         if federation_auth_origin is not None:
             headers[b"Authorization"] = [
-                b"X-Matrix origin=%s,key=,sig=" % (federation_auth_origin, )
+                b"X-Matrix origin=%s,key=,sig=" % (federation_auth_origin,)
             ]
         mock_request.requestHeaders.getRawHeaders = mock_getRawHeaders(headers)
 
@@ -577,16 +581,16 @@ def create_room(hs, room_id, creator_id):
     event_builder_factory = hs.get_event_builder_factory()
     event_creation_handler = hs.get_event_creation_handler()
 
-    builder = event_builder_factory.new({
-        "type": EventTypes.Create,
-        "state_key": "",
-        "sender": creator_id,
-        "room_id": room_id,
-        "content": {},
-    })
-
-    event, context = yield event_creation_handler.create_new_client_event(
-        builder
+    builder = event_builder_factory.new(
+        {
+            "type": EventTypes.Create,
+            "state_key": "",
+            "sender": creator_id,
+            "room_id": room_id,
+            "content": {},
+        }
     )
 
+    event, context = yield event_creation_handler.create_new_client_event(builder)
+
     yield store.persist_event(event, context)