Add flow test for `CameraConnectionErrorView`
What changed, and why it matters
This commit only adds a new automated test that checks what happens when the camera fails to connect. It does not change any production code, so it cannot introduce a security vulnerability or fix one.
No security action needed. Review as normal test coverage.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a single test method, test__camera_connection_error__flow, to tests/test_flows_view.py. It simulates a CameraConnectionError being raised inside ScanView and asserts the resulting view flow (UnhandledExceptionView redirect, CameraConnectionErrorView, then MainMenuView). No application logic is modified.
Changed components
tests/test_flows_view.pyInspect captured patch +20 / −1
diff --git a/tests/test_flows_view.py b/tests/test_flows_view.py
index 05a7442..1e00557 100644
--- a/tests/test_flows_view.py
+++ b/tests/test_flows_view.py
@@ -4,9 +4,11 @@ from unittest.mock import patch
from base import FlowTest, FlowStep
from seedsigner.gui.screens.screen import RET_CODE__POWER_BUTTON
+from seedsigner.hardware.camera import CameraConnectionError
from seedsigner.models.settings import Settings
+from seedsigner.views.scan_views import ScanView
from seedsigner.views.tools_views import ToolsCalcFinalWordNumWordsView, ToolsMenuView
-from seedsigner.views.view import MainMenuView, NotYetImplementedView, PowerOptionsView, PowerOffView, RestartView, UnhandledExceptionView, View
+from seedsigner.views.view import CameraConnectionErrorView, MainMenuView, NotYetImplementedView, PowerOptionsView, PowerOffView, RestartView, UnhandledExceptionView, View
@@ -64,3 +66,20 @@ class TestViewFlows(FlowTest):
FlowStep(UnhandledExceptionView),
FlowStep(MainMenuView),
])
+
+
+ def test__camera_connection_error__flow(self):
+ """
+ Simulate a camera connection error and ensure that we get the
+ CameraConnectionErrorView.
+ """
+ def raise_camera_connection_error(view: View):
+ raise CameraConnectionError()
+
+ self.run_sequence([
+ FlowStep(MainMenuView, button_data_selection=MainMenuView.SCAN),
+ FlowStep(ScanView, before_run=raise_camera_connection_error),
+ FlowStep(UnhandledExceptionView, is_redirect=True),
+ FlowStep(CameraConnectionErrorView),
+ FlowStep(MainMenuView),
+ ])
\ No newline at end of file
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.