diff options
author | Emelie Graven <e.graven@famedly.com> | 2023-01-11 19:41:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 18:41:52 +0000 |
commit | dd9e71dc7fa91b81adfaaf8669aaf7ee976ffcd7 (patch) | |
tree | e54c2a02c07813e608fee098cf4c57ced49e50e8 /tests/module_api | |
parent | Factor out common code in tests and fix comments. (#14819) (diff) | |
download | synapse-dd9e71dc7fa91b81adfaaf8669aaf7ee976ffcd7.tar.xz |
Add `set_displayname` to the module API (#14629)
Diffstat (limited to 'tests/module_api')
-rw-r--r-- | tests/module_api/test_api.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/module_api/test_api.py b/tests/module_api/test_api.py index b0f3f4374d..9919938e80 100644 --- a/tests/module_api/test_api.py +++ b/tests/module_api/test_api.py @@ -110,6 +110,24 @@ class ModuleApiTestCase(HomeserverTestCase): self.assertEqual(found_user.user_id.to_string(), user_id) self.assertIdentical(found_user.is_admin, True) + def test_can_set_displayname(self): + localpart = "alice_wants_a_new_displayname" + user_id = self.register_user( + localpart, "1234", displayname="Alice", admin=False + ) + found_userinfo = self.get_success(self.module_api.get_userinfo_by_id(user_id)) + + self.get_success( + self.module_api.set_displayname( + found_userinfo.user_id, "Bob", deactivation=False + ) + ) + found_profile = self.get_success( + self.module_api.get_profile_for_user(localpart) + ) + + self.assertEqual(found_profile.display_name, "Bob") + def test_get_userinfo_by_id(self): user_id = self.register_user("alice", "1234") found_user = self.get_success(self.module_api.get_userinfo_by_id(user_id)) |