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

Commit 8b234fb

Browse files
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.
1 parent b8d7ca9 commit 8b234fb

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

changelog.d/64.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

tests/rest/client/test_room_access_rules.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,18 +518,19 @@ def test_change_rules(self):
518518
"""Tests that we can only change the current rule from restricted to
519519
unrestricted.
520520
"""
521+
# We can't change the rule from restricted to direct.
522+
self.change_rule_in_room(
523+
room_id=self.restricted_room, new_rule=AccessRules.DIRECT, expected_code=403
524+
)
525+
521526
# We can change the rule from restricted to unrestricted.
527+
# Note that this changes self.restricted_room to an unrestricted room
522528
self.change_rule_in_room(
523529
room_id=self.restricted_room,
524530
new_rule=AccessRules.UNRESTRICTED,
525531
expected_code=200,
526532
)
527533

528-
# We can't change the rule from restricted to direct.
529-
self.change_rule_in_room(
530-
room_id=self.restricted_room, new_rule=AccessRules.DIRECT, expected_code=403
531-
)
532-
533534
# We can't change the rule from unrestricted to restricted.
534535
self.change_rule_in_room(
535536
room_id=self.unrestricted_room,

0 commit comments

Comments
 (0)