What changed, and why it matters
This is a small change to a test file that makes the test suite simulate a camera error more realistically. It does not change the actual application code that users interact with, so it has no direct security impact on the product itself.
No security action needed. Review as normal test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies tests/test_flows_view.py to replace a custom before_run callback that raised CameraConnectionError with a unittest.mock.patch on ScanView.run that sets its side_effect to CameraConnectionError. This is purely a test-quality refactor: it improves how the test simulates an exception but does not alter ScanView or any production code paths.
Changed components
tests/test_flows_view.pyInspect captured patch +11 / −10
diff --git a/tests/test_flows_view.py b/tests/test_flows_view.py
index 1e00557..2e034cb 100644
--- a/tests/test_flows_view.py
+++ b/tests/test_flows_view.py
@@ -72,14 +72,15 @@ class TestViewFlows(FlowTest):
"""
Simulate a camera connection error and ensure that we get the
CameraConnectionErrorView.
- """
- def raise_camera_connection_error(view: View):
- raise CameraConnectionError()
+ """
+ # Force a camera exception during `ScanView.run()`
+ with patch('seedsigner.views.scan_views.ScanView.run') as mock_run:
+ mock_run.side_effect = 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
+ self.run_sequence([
+ FlowStep(MainMenuView, button_data_selection=MainMenuView.SCAN),
+ FlowStep(ScanView),
+ FlowStep(UnhandledExceptionView, is_redirect=True),
+ FlowStep(CameraConnectionErrorView),
+ FlowStep(MainMenuView),
+ ])
\ No newline at end of file
Why this scored 14/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.