summary refs log tree commit diff
path: root/tests/rest/client/test_profile.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-07-04 18:08:56 +0100
committerGitHub <noreply@github.com>2022-07-04 18:08:56 +0100
commitd102ad67fddc650c34baa89dc7b2926d46a9aeca (patch)
tree542df6d58640540ea934cd7a5bd0e1486fe96bdf /tests/rest/client/test_profile.py
parentRevert "Up the dependency on canonicaljson to ^1.5.0" (diff)
downloadsynapse-d102ad67fddc650c34baa89dc7b2926d46a9aeca.tar.xz
annotate tests.server.FakeChannel (#13136)
Diffstat (limited to 'tests/rest/client/test_profile.py')
-rw-r--r--tests/rest/client/test_profile.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/rest/client/test_profile.py b/tests/rest/client/test_profile.py
index 29bed0e872..8de5a342ae 100644
--- a/tests/rest/client/test_profile.py
+++ b/tests/rest/client/test_profile.py
@@ -153,18 +153,22 @@ class ProfileTestCase(unittest.HomeserverTestCase):
         )
         self.assertEqual(channel.code, 400, channel.result)
 
-    def _get_displayname(self, name: Optional[str] = None) -> str:
+    def _get_displayname(self, name: Optional[str] = None) -> Optional[str]:
         channel = self.make_request(
             "GET", "/profile/%s/displayname" % (name or self.owner,)
         )
         self.assertEqual(channel.code, 200, channel.result)
-        return channel.json_body["displayname"]
+        # FIXME: If a user has no displayname set, Synapse returns 200 and omits a
+        # displayname from the response. This contradicts the spec, see #13137.
+        return channel.json_body.get("displayname")
 
-    def _get_avatar_url(self, name: Optional[str] = None) -> str:
+    def _get_avatar_url(self, name: Optional[str] = None) -> Optional[str]:
         channel = self.make_request(
             "GET", "/profile/%s/avatar_url" % (name or self.owner,)
         )
         self.assertEqual(channel.code, 200, channel.result)
+        # FIXME: If a user has no avatar set, Synapse returns 200 and omits an
+        # avatar_url from the response. This contradicts the spec, see #13137.
         return channel.json_body.get("avatar_url")
 
     @unittest.override_config({"max_avatar_size": 50})