summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMohit Rathee <mohit.rathee2505@gmail.com>2023-08-01 18:44:02 +0530
committerGitHub <noreply@github.com>2023-08-01 09:14:02 -0400
commit5eb3fd785bdbf2ae07031f13a6ac5fb578adc338 (patch)
tree95c637b7dc13357cc8ac2e620a51d480e1e2ad46 /tests
parentAdd metrics tracking for eviction to ResponseCache (#16028) (diff)
downloadsynapse-5eb3fd785bdbf2ae07031f13a6ac5fb578adc338.tar.xz
Trim whitespace when setting display names (#16031)
Diffstat (limited to 'tests')
-rw-r--r--tests/rest/client/test_profile.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/rest/client/test_profile.py b/tests/rest/client/test_profile.py
index 27c93ad761..ecae092b47 100644
--- a/tests/rest/client/test_profile.py
+++ b/tests/rest/client/test_profile.py
@@ -68,6 +68,18 @@ class ProfileTestCase(unittest.HomeserverTestCase):
         res = self._get_displayname()
         self.assertEqual(res, "test")
 
+    def test_set_displayname_with_extra_spaces(self) -> None:
+        channel = self.make_request(
+            "PUT",
+            "/profile/%s/displayname" % (self.owner,),
+            content={"displayname": "  test  "},
+            access_token=self.owner_tok,
+        )
+        self.assertEqual(channel.code, 200, channel.result)
+
+        res = self._get_displayname()
+        self.assertEqual(res, "test")
+
     def test_set_displayname_noauth(self) -> None:
         channel = self.make_request(
             "PUT",