refactor 12/24 word tests into a single test
What changed, and why it matters
This commit is a simple cleanup of automated tests. It merges two nearly identical test cases (one for 12-word seeds and one for 24-word seeds) into a single test that loops over both seed types. No production code was changed, and there is no security relevance.
No action needed. This is a non-security test refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff only modifies tests/test_flows_seed.py. It replaces two separate methods, test_back_from_seed_entry_12_word and test_back_from_seed_entry_24_word, with one method, test_back_from_seed_entry_first_word, that iterates over TYPE_12WORD and TYPE_24WORD and calls BaseTest.reset_controller() between iterations. The actual flow sequence being tested is unchanged. No application logic, cryptography, input handling, or UI code is affected.
Changed components
tests/test_flows_seed.pyInspect captured patch +11 / −23
diff --git a/tests/test_flows_seed.py b/tests/test_flows_seed.py
index 03dfc88..601e7a4 100644
--- a/tests/test_flows_seed.py
+++ b/tests/test_flows_seed.py
@@ -504,32 +504,20 @@ class TestSeedEntryBackFlows(FlowTest):
returns to the correct parent view AND that no flow state leaks.
"""
- def test_back_from_seed_entry_12_word(self):
+ def test_back_from_seed_entry_first_word(self):
"""
- Seeds Menu → Load a Seed → Enter 12-word → BACK on first word →
+ Seeds Menu → Load a Seed → Enter 12/24-word → BACK on first word →
should return to LoadSeedView, NOT MainMenuView.
"""
- self.run_sequence([
- FlowStep(MainMenuView, button_data_selection=MainMenuView.SEEDS),
- FlowStep(seed_views.SeedsMenuView, is_redirect=True), # No seeds loaded; auto-redirects to LoadSeedView
- FlowStep(seed_views.LoadSeedView, button_data_selection=seed_views.LoadSeedView.TYPE_12WORD),
- FlowStep(seed_views.SeedMnemonicEntryView, screen_return_value=RET_CODE__BACK_BUTTON),
- FlowStep(seed_views.LoadSeedView), # Should land here, NOT MainMenuView
- ])
-
-
- def test_back_from_seed_entry_24_word(self):
- """
- Seeds Menu → Load a Seed → Enter 24-word → BACK on first word →
- should return to LoadSeedView, NOT MainMenuView.
- """
- self.run_sequence([
- FlowStep(MainMenuView, button_data_selection=MainMenuView.SEEDS),
- FlowStep(seed_views.SeedsMenuView, is_redirect=True), # No seeds loaded; auto-redirects to LoadSeedView
- FlowStep(seed_views.LoadSeedView, button_data_selection=seed_views.LoadSeedView.TYPE_24WORD),
- FlowStep(seed_views.SeedMnemonicEntryView, screen_return_value=RET_CODE__BACK_BUTTON),
- FlowStep(seed_views.LoadSeedView), # Should land here, NOT MainMenuView
- ])
+ for seed_type in [seed_views.LoadSeedView.TYPE_12WORD, seed_views.LoadSeedView.TYPE_24WORD]:
+ self.run_sequence([
+ FlowStep(MainMenuView, button_data_selection=MainMenuView.SEEDS),
+ FlowStep(seed_views.SeedsMenuView, is_redirect=True), # No seeds loaded; auto-redirects to LoadSeedView
+ FlowStep(seed_views.LoadSeedView, button_data_selection=seed_type),
+ FlowStep(seed_views.SeedMnemonicEntryView, screen_return_value=RET_CODE__BACK_BUTTON),
+ FlowStep(seed_views.LoadSeedView), # Should land here, NOT MainMenuView
+ ])
+ BaseTest.reset_controller()
def test_back_from_seed_entry_mid_word(self):
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.