mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 19:44:51 -04:00
Admin api to add an email address (#6789)
This commit is contained in:
parent
f4884444c3
commit
56ca93ef59
6 changed files with 78 additions and 2 deletions
|
@ -407,7 +407,13 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||
"""
|
||||
self.hs.config.registration_shared_secret = None
|
||||
|
||||
body = json.dumps({"password": "abc123", "admin": True})
|
||||
body = json.dumps(
|
||||
{
|
||||
"password": "abc123",
|
||||
"admin": True,
|
||||
"threepids": [{"medium": "email", "address": "bob@bob.bob"}],
|
||||
}
|
||||
)
|
||||
|
||||
# Create user
|
||||
request, channel = self.make_request(
|
||||
|
@ -421,6 +427,8 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||
self.assertEqual(201, int(channel.result["code"]), msg=channel.result["body"])
|
||||
self.assertEqual("@bob:test", channel.json_body["name"])
|
||||
self.assertEqual("bob", channel.json_body["displayname"])
|
||||
self.assertEqual("email", channel.json_body["threepids"][0]["medium"])
|
||||
self.assertEqual("bob@bob.bob", channel.json_body["threepids"][0]["address"])
|
||||
|
||||
# Get user
|
||||
request, channel = self.make_request(
|
||||
|
@ -449,7 +457,13 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||
self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"])
|
||||
|
||||
# Modify user
|
||||
body = json.dumps({"displayname": "foobar", "deactivated": True})
|
||||
body = json.dumps(
|
||||
{
|
||||
"displayname": "foobar",
|
||||
"deactivated": True,
|
||||
"threepids": [{"medium": "email", "address": "bob2@bob.bob"}],
|
||||
}
|
||||
)
|
||||
|
||||
request, channel = self.make_request(
|
||||
"PUT",
|
||||
|
@ -463,6 +477,7 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||
self.assertEqual("@bob:test", channel.json_body["name"])
|
||||
self.assertEqual("foobar", channel.json_body["displayname"])
|
||||
self.assertEqual(True, channel.json_body["deactivated"])
|
||||
# the user is deactivated, the threepid will be deleted
|
||||
|
||||
# Get user
|
||||
request, channel = self.make_request(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue