summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-07-28 16:09:53 -0400
committerGitHub <noreply@github.com>2020-07-28 16:09:53 -0400
commit3345c166a45cb4a8f87c583ee0476c2bca5c41bd (patch)
tree8bc5a87a123313c2da008e4a82d0621459b717c5 /tests/utils.py
parentAdd an option to disable purge in delete room admin API (#7964) (diff)
downloadsynapse-3345c166a45cb4a8f87c583ee0476c2bca5c41bd.tar.xz
Convert storage layer to async/await. (#7963)
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/utils.py b/tests/utils.py
index ac643679aa..b33b6860d4 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -638,14 +638,8 @@ class DeferredMockCallable(object):
             )
 
 
-@defer.inlineCallbacks
-def create_room(hs, room_id, creator_id):
+async def create_room(hs, room_id: str, creator_id: str):
     """Creates and persist a creation event for the given room
-
-    Args:
-        hs
-        room_id (str)
-        creator_id (str)
     """
 
     persistence_store = hs.get_storage().persistence
@@ -653,7 +647,7 @@ def create_room(hs, room_id, creator_id):
     event_builder_factory = hs.get_event_builder_factory()
     event_creation_handler = hs.get_event_creation_handler()
 
-    yield store.store_room(
+    await store.store_room(
         room_id=room_id,
         room_creator_user_id=creator_id,
         is_public=False,
@@ -671,8 +665,6 @@ def create_room(hs, room_id, creator_id):
         },
     )
 
-    event, context = yield defer.ensureDeferred(
-        event_creation_handler.create_new_client_event(builder)
-    )
+    event, context = await event_creation_handler.create_new_client_event(builder)
 
-    yield persistence_store.persist_event(event, context)
+    await persistence_store.persist_event(event, context)