Admin api to add an email address (#6789)

This commit is contained in:
Dirk Klimpel 2020-02-07 11:29:36 +01:00 committed by GitHub
parent f4884444c3
commit 56ca93ef59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 2 deletions

View file

@ -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(