test: align suite with shipped behavior (WiFi swap, BUG-10 guard, odometer_baseline)
- test_app_trip + test_trip_sql: mock was_car_ever_connected() so trip building runs (BUG-10 guard suppresses trips until car ECU reached) - test_app_settings: include odometer_baseline in valid payload + assert save - test_yaris_uplink: Hotspot -> Hotspot-local; restore_fallback no longer activates AP (reports no_connection); wait timeout writes fallback_restored - test_app_network: local_hotspot mode removed by WiFi swap -> wifi/no-internet
This commit is contained in:
+11
-16
@@ -70,7 +70,7 @@ class UplinkSelectionTest(unittest.TestCase):
|
||||
@patch("deploy.yaris_uplink.phone_is_visible", return_value=True)
|
||||
@patch("deploy.yaris_uplink.activate", return_value=True)
|
||||
@patch("deploy.yaris_uplink.connection_exists", return_value=True)
|
||||
@patch("deploy.yaris_uplink.active_connection", return_value="Hotspot")
|
||||
@patch("deploy.yaris_uplink.active_connection", return_value="Hotspot-local")
|
||||
def test_phone_is_preferred_over_home_from_local_hotspot(
|
||||
self,
|
||||
_active,
|
||||
@@ -135,25 +135,18 @@ class UplinkSelectionTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
@patch("deploy.yaris_uplink.write_status")
|
||||
@patch(
|
||||
"deploy.yaris_uplink.activate",
|
||||
side_effect=[False, True],
|
||||
)
|
||||
def test_local_hotspot_is_restored_when_home_is_unavailable(
|
||||
@patch("deploy.yaris_uplink.activate", return_value=False)
|
||||
def test_home_unavailable_reports_no_connection(
|
||||
self,
|
||||
activate,
|
||||
write_status,
|
||||
):
|
||||
self.assertTrue(yaris_uplink.restore_fallback())
|
||||
|
||||
self.assertEqual(
|
||||
activate.call_args_list,
|
||||
[
|
||||
call("home-wifi"),
|
||||
call("Hotspot"),
|
||||
],
|
||||
activate.assert_called_once_with("home-wifi")
|
||||
write_status.assert_called_once_with(
|
||||
"no_connection", "No home WiFi or phone hotspot available."
|
||||
)
|
||||
write_status.assert_called_once_with("restored_local_hotspot")
|
||||
|
||||
|
||||
class UplinkWaitTest(unittest.TestCase):
|
||||
@@ -188,8 +181,10 @@ class UplinkWaitTest(unittest.TestCase):
|
||||
@patch("deploy.yaris_uplink.write_status")
|
||||
@patch("deploy.yaris_uplink.active_connection", return_value="home-wifi")
|
||||
@patch("deploy.yaris_uplink.connection_exists", return_value=True)
|
||||
def test_wait_timeout_preserves_current_client_connection(
|
||||
@patch("deploy.yaris_uplink._connect_home_or_idle", return_value=True)
|
||||
def test_wait_timeout_restores_home_fallback(
|
||||
self,
|
||||
_home,
|
||||
_exists,
|
||||
_active,
|
||||
write_status,
|
||||
@@ -201,14 +196,14 @@ class UplinkWaitTest(unittest.TestCase):
|
||||
|
||||
write_status.assert_any_call("waiting_for_phone")
|
||||
write_status.assert_called_with(
|
||||
"phone_wait_timed_out_current_connection_preserved",
|
||||
"phone_wait_timed_out_fallback_restored",
|
||||
"Phone hotspot did not appear within two minutes.",
|
||||
)
|
||||
|
||||
|
||||
class UplinkTransitionTest(unittest.TestCase):
|
||||
@patch("deploy.yaris_uplink.write_status")
|
||||
@patch("deploy.yaris_uplink.active_connection", return_value="Hotspot")
|
||||
@patch("deploy.yaris_uplink.active_connection", return_value="Hotspot-local")
|
||||
def test_records_networkmanager_fallback(self, _active, write_status):
|
||||
yaris_uplink.record_current_connection()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user