@@ -804,8 +804,8 @@ def test_periodic_refresh_starts_on_init(
804804 AND: root.after should have been called to schedule the next recurring refresh
805805 AND: The widget should not be in a refreshing state after initialization completes
806806 """
807- periodic_widget ._mock_fc .discover_connections .assert_called_once_with ( # type: ignore[attr-defined]
808- progress_callback = None , preserved_connections = []
807+ periodic_widget ._mock_fc .discover_connections .assert_any_call ( # type: ignore[attr-defined]
808+ preserved_connections = []
809809 )
810810 mock_parent .root .after .assert_called_with (3000 , periodic_widget ._refresh_ports )
811811 assert periodic_widget ._is_refreshing is False
@@ -1004,12 +1004,12 @@ def test_history_cache_is_populated_from_program_settings_on_startup(self) -> No
10041004
10051005 def test_stored_connections_are_registered_with_flight_controller_on_init (self ) -> None :
10061006 """
1007- Each connection in the loaded history is registered with the flight controller .
1007+ History connections are passed to discover_connections on init .
10081008
10091009 GIVEN: ProgramSettings holds two previously used connections
10101010 WHEN: ConnectionSelectionWidgets is initialized
1011- THEN: flight_controller.add_connection should have been called once per stored entry
1012- AND: Each call should use the exact stored connection string
1011+ THEN: flight_controller.discover_connections should have been called with preserved_connections
1012+ AND: The preserved_connections should contain each stored entry
10131013 """
10141014 history = ["COM1" , "tcp:127.0.0.1:5761" ]
10151015 mock_parent = MagicMock ()
@@ -1036,9 +1036,8 @@ def test_stored_connections_are_registered_with_flight_controller_on_init(self)
10361036 download_params_on_connect = False ,
10371037 )
10381038
1039- calls = [call [0 ][0 ] for call in mock_fc .add_connection .call_args_list ]
1040- assert "COM1" in calls
1041- assert "tcp:127.0.0.1:5761" in calls
1039+ mock_fc .discover_connections .assert_any_call (preserved_connections = history )
1040+ mock_fc .add_connection .assert_not_called ()
10421041
10431042 def test_history_cache_is_empty_when_settings_has_no_stored_connections (self ) -> None :
10441043 """
@@ -1162,7 +1161,7 @@ def test_persist_and_cache_deduplicates_existing_matching_cache_entry(
11621161 self , persist_widget : tuple [ConnectionSelectionWidgets , MagicMock , MagicMock ]
11631162 ) -> None :
11641163 """
1165- _persist_and_cache_connection removes the old occurrence of a re-used connection.
1164+ _persist_and_cache_connection removes the old occurrence of a reused connection.
11661165
11671166 GIVEN: The cache already contains "COM3" at position 2
11681167 WHEN: "COM3" is persisted again (user reconnects to a previous device)
0 commit comments