From 702f130de2ba31b9c1b64b41a2be4b97ce877775 Mon Sep 17 00:00:00 2001 From: DEV-bot Date: Wed, 18 Mar 2026 05:00:48 +0000 Subject: [PATCH] test(lobby): lock issue-310 transition ownership boundary --- lobby/tests.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lobby/tests.py b/lobby/tests.py index e7b2741..a383530 100644 --- a/lobby/tests.py +++ b/lobby/tests.py @@ -107,6 +107,30 @@ class LobbyGameplayExtractionTests(TestCase): self.assertNotIn("build_reveal_scoreboard_response", source) self.assertNotIn("build_scoreboard_phase_event", source) + def test_issue_310_transition_views_keep_gameplay_logic_out_of_lobby(self): + transition_sources = { + "reveal_scoreboard": inspect.getsource(inspect.unwrap(lobby_views.reveal_scoreboard)), + "start_next_round": inspect.getsource(inspect.unwrap(lobby_views.start_next_round)), + "finish_game": inspect.getsource(inspect.unwrap(lobby_views.finish_game)), + } + + forbidden_snippets = ( + "select_round_question(", + "reset_round_question_bootstrap_state(", + "build_start_next_round_response(", + "build_start_next_round_phase_event(", + "build_finish_game_response(", + "build_finish_game_phase_event(", + "build_reveal_scoreboard_response(", + "build_scoreboard_phase_event(", + "ScoreEvent.objects.filter(", + "Player.objects.filter(", + ) + + for view_name, source in transition_sources.items(): + for snippet in forbidden_snippets: + self.assertNotIn(snippet, source, msg=f"{view_name} leaked gameplay snippet: {snippet}") + def test_session_detail_view_source_stays_http_thin(self): source = inspect.getsource(inspect.unwrap(lobby_views.session_detail))