summary refs log tree commit diff
path: root/tests/handlers
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-07-17 07:08:30 -0400
committerGitHub <noreply@github.com>2020-07-17 07:08:30 -0400
commit6fca1b3506e31e6864e1dc18046f1962813f14e2 (patch)
treeef15f4747dd7767e367c24589f1f0732fa943a91 /tests/handlers
parentAdd admin endpoint to get members in a room. (#7842) (diff)
downloadsynapse-6fca1b3506e31e6864e1dc18046f1962813f14e2.tar.xz
Convert _base, profile, and _receipts handlers to async/await (#7860)
Diffstat (limited to '')
-rw-r--r--tests/handlers/test_profile.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/handlers/test_profile.py b/tests/handlers/test_profile.py
index 29dd7d9c6e..4f1347cd25 100644
--- a/tests/handlers/test_profile.py
+++ b/tests/handlers/test_profile.py
@@ -72,7 +72,9 @@ class ProfileTestCase(unittest.TestCase):
     def test_get_my_name(self):
         yield self.store.set_profile_displayname(self.frank.localpart, "Frank")
 
-        displayname = yield self.handler.get_displayname(self.frank)
+        displayname = yield defer.ensureDeferred(
+            self.handler.get_displayname(self.frank)
+        )
 
         self.assertEquals("Frank", displayname)
 
@@ -140,7 +142,9 @@ class ProfileTestCase(unittest.TestCase):
             {"displayname": "Alice"}
         )
 
-        displayname = yield self.handler.get_displayname(self.alice)
+        displayname = yield defer.ensureDeferred(
+            self.handler.get_displayname(self.alice)
+        )
 
         self.assertEquals(displayname, "Alice")
         self.mock_federation.make_query.assert_called_with(
@@ -155,8 +159,10 @@ class ProfileTestCase(unittest.TestCase):
         yield self.store.create_profile("caroline")
         yield self.store.set_profile_displayname("caroline", "Caroline")
 
-        response = yield self.query_handlers["profile"](
-            {"user_id": "@caroline:test", "field": "displayname"}
+        response = yield defer.ensureDeferred(
+            self.query_handlers["profile"](
+                {"user_id": "@caroline:test", "field": "displayname"}
+            )
         )
 
         self.assertEquals({"displayname": "Caroline"}, response)
@@ -166,8 +172,7 @@ class ProfileTestCase(unittest.TestCase):
         yield self.store.set_profile_avatar_url(
             self.frank.localpart, "http://my.server/me.png"
         )
-
-        avatar_url = yield self.handler.get_avatar_url(self.frank)
+        avatar_url = yield defer.ensureDeferred(self.handler.get_avatar_url(self.frank))
 
         self.assertEquals("http://my.server/me.png", avatar_url)