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.
This commit is contained in:
1
changelog.d/64.bugfix
Normal file
1
changelog.d/64.bugfix
Normal file
@@ -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.
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user