diff options
author | andrew do <andrewddo@gmail.com> | 2022-08-03 05:26:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-03 14:26:31 +0200 |
commit | 78a3111c41bf93fd52774965af50d62b74d937de (patch) | |
tree | dfbf7dfc38a6252a5e66f8d417f4e27765be5009 /tests | |
parent | Install cryptography build dependencies in requirements image. (#13372) (diff) | |
download | synapse-78a3111c41bf93fd52774965af50d62b74d937de.tar.xz |
Return 404 or member list when getting joined_members after leaving (#13374)
Signed-off-by: Andrew Doh <andrewddo@gmail.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Andrew Morgan <andrewm@element.io> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/rest/admin/test_room.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/rest/admin/test_room.py b/tests/rest/admin/test_room.py index 623883b53c..989cbdb5e2 100644 --- a/tests/rest/admin/test_room.py +++ b/tests/rest/admin/test_room.py @@ -1772,6 +1772,21 @@ class RoomTestCase(unittest.HomeserverTestCase): tok=admin_user_tok, ) + def test_get_joined_members_after_leave_room(self) -> None: + """Test that requesting room members after leaving the room raises a 403 error.""" + + # create the room + user = self.register_user("foo", "pass") + user_tok = self.login("foo", "pass") + room_id = self.helper.create_room_as(user, tok=user_tok) + self.helper.leave(room_id, user, tok=user_tok) + + # delete the rooms and get joined roomed membership + url = f"/_matrix/client/r0/rooms/{room_id}/joined_members" + channel = self.make_request("GET", url.encode("ascii"), access_token=user_tok) + self.assertEqual(HTTPStatus.FORBIDDEN, channel.code, msg=channel.json_body) + self.assertEqual(Codes.FORBIDDEN, channel.json_body["errcode"]) + class JoinAliasRoomTestCase(unittest.HomeserverTestCase): |