mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 16:24:48 -04:00
Add set_displayname
to the module API (#14629)
This commit is contained in:
parent
071f8b0f9b
commit
dd9e71dc7f
3 changed files with 46 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue