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

Commit

Permalink
Test that a room cannot be set to 'unrestricted' if it's in the publi…
Browse files Browse the repository at this point in the history
…c room dir
  • Loading branch information
anoadragon453 committed Sep 11, 2020
1 parent 271b1e5 commit 47b604e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/rest/client/test_room_access_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,24 @@ def test_change_rules(self):
new_rule=AccessRules.UNRESTRICTED,
expected_code=403,
)
# We can't publish a room to the public rooms directory and then change its rule
# to unrestricted

# Create a restricted room
test_room_id = self.create_room()

# Publish the room to the public rooms directory
url = "/_matrix/client/r0/directory/list/room/%s" % test_room_id
data = {"visibility": "public"}

request, channel = self.make_request("PUT", url, data, access_token=self.tok)
self.render(request)
self.assertEqual(channel.code, 200, channel.result)

# Attempt to switch the room to "unrestricted"
self.change_rule_in_room(
room_id=test_room_id, new_rule=AccessRules.UNRESTRICTED, expected_code=403
)

def test_change_room_avatar(self):
"""Tests that changing the room avatar is always allowed unless the room is a
Expand Down

0 comments on commit 47b604e

Please sign in to comment.