From 074483ddd891c3fdb606ad95213fc96cacc007e0 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 17 Jan 2025 19:15:37 -0600 Subject: [PATCH] Fix sync join/ban race test failing We're now better at rejecting this --- tests/handlers/test_sync.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/handlers/test_sync.py b/tests/handlers/test_sync.py index 9dd0e98971b..0cbc9a8a21d 100644 --- a/tests/handlers/test_sync.py +++ b/tests/handlers/test_sync.py @@ -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 @@ -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(