mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 16:34:47 -04:00
Fix a bug in the joined_rooms admin API (#8643)
If the user was not in any rooms then the API returned the same error as if the user did not exist.
This commit is contained in:
parent
cf9a17a2b3
commit
4ac3a8c5dc
3 changed files with 20 additions and 4 deletions
|
@ -1016,7 +1016,6 @@ class UserMembershipRestTestCase(unittest.HomeserverTestCase):
|
|||
servlets = [
|
||||
synapse.rest.admin.register_servlets,
|
||||
login.register_servlets,
|
||||
sync.register_servlets,
|
||||
room.register_servlets,
|
||||
]
|
||||
|
||||
|
@ -1082,6 +1081,21 @@ class UserMembershipRestTestCase(unittest.HomeserverTestCase):
|
|||
self.assertEqual(400, channel.code, msg=channel.json_body)
|
||||
self.assertEqual("Can only lookup local users", channel.json_body["error"])
|
||||
|
||||
def test_no_memberships(self):
|
||||
"""
|
||||
Tests that a normal lookup for rooms is successfully
|
||||
if user has no memberships
|
||||
"""
|
||||
# Get rooms
|
||||
request, channel = self.make_request(
|
||||
"GET", self.url, access_token=self.admin_user_tok,
|
||||
)
|
||||
self.render(request)
|
||||
|
||||
self.assertEqual(200, channel.code, msg=channel.json_body)
|
||||
self.assertEqual(0, channel.json_body["total"])
|
||||
self.assertEqual(0, len(channel.json_body["joined_rooms"]))
|
||||
|
||||
def test_get_rooms(self):
|
||||
"""
|
||||
Tests that a normal lookup for rooms is successfully
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue