summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2020-09-18 11:37:21 +0100
committerGitHub <noreply@github.com>2020-09-18 11:37:21 +0100
commit8b234fb2163a264bd38951ae3a16c39c6b207bf1 (patch)
tree45ef5cd33f4a380345bf7fcbb4db0c42829dfb70
parentMake all rooms noisy by default (#60) (diff)
downloadsynapse-8b234fb2163a264bd38951ae3a16c39c6b207bf1.tar.xz
Swap method calls in RoomAccessTestCase.test_change_rules (#64)
Swap these calls around, as the check for changing `restricted` to `unrestricted` will actually change `self.restricted_room` to an unrestricted room.

Do that last, instead of first. Additionally add a comment with a warning.
-rw-r--r--changelog.d/64.bugfix1
-rw-r--r--tests/rest/client/test_room_access_rules.py11
2 files changed, 7 insertions, 5 deletions
diff --git a/changelog.d/64.bugfix b/changelog.d/64.bugfix
new file mode 100644

index 0000000000..60c077af94 --- /dev/null +++ b/changelog.d/64.bugfix
@@ -0,0 +1 @@ +Ensure a `RoomAccessRules` test doesn't accidentally modify a room's access rule and then test that room assuming its access rule has not changed. diff --git a/tests/rest/client/test_room_access_rules.py b/tests/rest/client/test_room_access_rules.py
index ae59f8f911..6582cd288d 100644 --- a/tests/rest/client/test_room_access_rules.py +++ b/tests/rest/client/test_room_access_rules.py
@@ -518,18 +518,19 @@ class RoomAccessTestCase(unittest.HomeserverTestCase): """Tests that we can only change the current rule from restricted to unrestricted. """ + # We can't change the rule from restricted to direct. + self.change_rule_in_room( + room_id=self.restricted_room, new_rule=AccessRules.DIRECT, expected_code=403 + ) + # We can change the rule from restricted to unrestricted. + # Note that this changes self.restricted_room to an unrestricted room self.change_rule_in_room( room_id=self.restricted_room, new_rule=AccessRules.UNRESTRICTED, expected_code=200, ) - # We can't change the rule from restricted to direct. - self.change_rule_in_room( - room_id=self.restricted_room, new_rule=AccessRules.DIRECT, expected_code=403 - ) - # We can't change the rule from unrestricted to restricted. self.change_rule_in_room( room_id=self.unrestricted_room,