test(lobby): lock issue-310 transition ownership boundary
This commit is contained in:
@@ -107,6 +107,30 @@ class LobbyGameplayExtractionTests(TestCase):
|
|||||||
self.assertNotIn("build_reveal_scoreboard_response", source)
|
self.assertNotIn("build_reveal_scoreboard_response", source)
|
||||||
self.assertNotIn("build_scoreboard_phase_event", 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):
|
def test_session_detail_view_source_stays_http_thin(self):
|
||||||
source = inspect.getsource(inspect.unwrap(lobby_views.session_detail))
|
source = inspect.getsource(inspect.unwrap(lobby_views.session_detail))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user