Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
dklimpel committed Aug 17, 2021
1 parent 0afc4ec commit 48e3bbc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/rest/admin/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,10 +1694,15 @@ def test_set_threepid(self):
self.assertEqual(200, channel.code, msg=channel.json_body)
self.assertEqual("@user:test", channel.json_body["name"])
self.assertEqual(2, len(channel.json_body["threepids"]))
self.assertEqual("email", channel.json_body["threepids"][0]["medium"])
self.assertEqual("bob1@bob.bob", channel.json_body["threepids"][0]["address"])
self.assertEqual("email", channel.json_body["threepids"][1]["medium"])
self.assertEqual("bob2@bob.bob", channel.json_body["threepids"][1]["address"])
# result does not always have the same sort order, therefore it becomes sorted
sorted_result = sorted(
channel.json_body["threepids"], key=lambda k: k["address"]
)
self.assertEqual("email", sorted_result[0]["medium"])
self.assertEqual("bob1@bob.bob", sorted_result[0]["address"])
self.assertEqual("email", sorted_result[1]["medium"])
self.assertEqual("bob2@bob.bob", sorted_result[1]["address"])
self._check_fields(channel.json_body)

# Set a new and remove a threepid
channel = self.make_request(
Expand All @@ -1719,6 +1724,7 @@ def test_set_threepid(self):
self.assertEqual("bob2@bob.bob", channel.json_body["threepids"][0]["address"])
self.assertEqual("email", channel.json_body["threepids"][1]["medium"])
self.assertEqual("bob3@bob.bob", channel.json_body["threepids"][1]["address"])
self._check_fields(channel.json_body)

# Get user
channel = self.make_request(
Expand All @@ -1734,6 +1740,7 @@ def test_set_threepid(self):
self.assertEqual("bob2@bob.bob", channel.json_body["threepids"][0]["address"])
self.assertEqual("email", channel.json_body["threepids"][1]["medium"])
self.assertEqual("bob3@bob.bob", channel.json_body["threepids"][1]["address"])
self._check_fields(channel.json_body)

# Remove threepids
channel = self.make_request(
Expand All @@ -1745,6 +1752,7 @@ def test_set_threepid(self):
self.assertEqual(200, channel.code, msg=channel.json_body)
self.assertEqual("@user:test", channel.json_body["name"])
self.assertEqual(0, len(channel.json_body["threepids"]))
self._check_fields(channel.json_body)

def test_set_external_id(self):
"""
Expand Down

0 comments on commit 48e3bbc

Please sign in to comment.