Skip to content

Commit

Permalink
Fix sync join/ban race test failing
Browse files Browse the repository at this point in the history
We're now better at rejecting this
  • Loading branch information
MadLittleMods committed Jan 18, 2025
1 parent 78bee3d commit 074483d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/handlers/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#
from typing import Collection, ContextManager, List, Optional
from unittest.mock import AsyncMock, Mock, patch
from http import HTTPStatus

from parameterized import parameterized, parameterized_class

Expand Down Expand Up @@ -347,7 +348,15 @@ def test_ban_wins_race_with_join(self) -> None:
# the prev_events used when creating the join event, such that the ban does not
# precede the join.
with self._patch_get_latest_events([last_room_creation_event_id]):
self.helper.join(room_id, eve, tok=eve_token)
self.helper.join(
room_id,
eve,
tok=eve_token,
# Previously, this join would succeed but now we expect it to fail at
# this point. The rest of the test is for the case when this used to
# succeed.
expect_code=HTTPStatus.FORBIDDEN,
)

# Eve makes a second, incremental sync.
eve_incremental_sync_after_join: SyncResult = self.get_success(
Expand Down

0 comments on commit 074483d

Please sign in to comment.