Fix inadvertantly persistent test artifacts
What changed, and why it matters
This commit only changes test files. It removes direct assignments to a shared Settings.HOSTNAME variable inside tests and replaces one with a temporary mock. This prevents test runs from accidentally leaving the simulated device hostname in an unexpected state for later tests. There is no change to the actual SeedSigner application or its security behavior.
No security action needed. Treat as routine test-quality cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies tests/test_flows_seed.py and tests/test_flows_view.py. It deletes two lines that mutated Settings.HOSTNAME globally during seed flow tests and wraps the power-off flow test in a patch.object context manager so Settings.HOSTNAME is temporarily set to SEEDSIGNER_OS. This is a test-hygiene fix to avoid persistent test artifacts; it does not alter production code, cryptographic logic, UI flows, or any attack surface.
Changed components
tests/test_flows_seed.pytests/test_flows_view.pyInspect captured patch +7 / −9
diff --git a/tests/test_flows_seed.py b/tests/test_flows_seed.py
index 2b2339f..98c5048 100644
--- a/tests/test_flows_seed.py
+++ b/tests/test_flows_seed.py
@@ -61,7 +61,6 @@ class TestSeedFlows(FlowTest):
the SeedOptionsView.
"""
def test_with_mnemonic(mnemonic):
- Settings.HOSTNAME = "not seedsigner-os"
sequence = [
FlowStep(MainMenuView, button_data_selection=MainMenuView.SEEDS),
FlowStep(seed_views.SeedsMenuView, is_redirect=True), # When no seeds are loaded it auto-redirects to LoadSeedView
@@ -128,7 +127,6 @@ class TestSeedFlows(FlowTest):
Most BIP-39 mnemonics should generate an error if entered as Electrum seeds.
"""
def test_with_mnemonic(mnemonic: list[str], custom_extension: str = None, expects_electrum_seed_is_valid: bool = True):
- Settings.HOSTNAME = "not seedsigner-os"
settings = Settings.get_instance()
settings.set_value(SettingsConstants.SETTING__ELECTRUM_SEEDS, SettingsConstants.OPTION__ENABLED)
diff --git a/tests/test_flows_view.py b/tests/test_flows_view.py
index 2e034cb..bdb1410 100644
--- a/tests/test_flows_view.py
+++ b/tests/test_flows_view.py
@@ -30,13 +30,13 @@ class TestViewFlows(FlowTest):
"""
Basic flow from MainMenuView to PowerOffView
"""
- Settings.HOSTNAME = Settings.SEEDSIGNER_OS
- self.run_sequence([
- FlowStep(MainMenuView, screen_return_value=RET_CODE__POWER_BUTTON),
- FlowStep(PowerOptionsView, button_data_selection=PowerOptionsView.POWER_OFF),
- FlowStep(PowerOffView), # returns BackStackView
- FlowStep(PowerOptionsView),
- ])
+ with patch.object(Settings, 'HOSTNAME', return_value=Settings.SEEDSIGNER_OS):
+ self.run_sequence([
+ FlowStep(MainMenuView, screen_return_value=RET_CODE__POWER_BUTTON),
+ FlowStep(PowerOptionsView, button_data_selection=PowerOptionsView.POWER_OFF),
+ FlowStep(PowerOffView), # returns BackStackView
+ FlowStep(PowerOptionsView),
+ ])
def test_not_yet_implemented_flow(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.