From 002bf80a1ff5e1a79d96bafaafb21a624810d411 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 31 Mar 2026 10:17:02 +0200 Subject: [PATCH] Update tests --- .../mobile_app/test_device_tracker.py | 55 +++++++++++++++---- tests/components/mqtt/test_diagnostics.py | 1 + 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/tests/components/mobile_app/test_device_tracker.py b/tests/components/mobile_app/test_device_tracker.py index 46e3b6e5e6a..8f56710f187 100644 --- a/tests/components/mobile_app/test_device_tracker.py +++ b/tests/components/mobile_app/test_device_tracker.py @@ -51,53 +51,83 @@ async def setup_zone(hass: HomeAssistant) -> None: # Send coordinates + location_name: Location name has precedence ( {"gps": [10, 20], "location_name": "home"}, - {"latitude": 10, "longitude": 20, "gps_accuracy": 30}, + { + "latitude": 10, + "longitude": 20, + "gps_accuracy": 30, + "in_zones": ["zone.home"], + }, "home", ), ( {"gps": [20, 30], "location_name": "office"}, - {"latitude": 20, "longitude": 30, "gps_accuracy": 30}, + { + "latitude": 20, + "longitude": 30, + "gps_accuracy": 30, + "in_zones": ["zone.office"], + }, "Office", ), ( {"gps": [30, 40], "location_name": "school"}, - {"latitude": 30, "longitude": 40, "gps_accuracy": 30}, + { + "latitude": 30, + "longitude": 40, + "gps_accuracy": 30, + "in_zones": ["zone.school"], + }, "School", ), # Send wrong coordinates + location_name: Location name has precedence ( {"gps": [10, 10], "location_name": "home"}, - {"latitude": 10, "longitude": 10, "gps_accuracy": 30}, + {"latitude": 10, "longitude": 10, "gps_accuracy": 30, "in_zones": []}, "home", ), ( {"gps": [10, 10], "location_name": "office"}, - {"latitude": 10, "longitude": 10, "gps_accuracy": 30}, + {"latitude": 10, "longitude": 10, "gps_accuracy": 30, "in_zones": []}, "Office", ), ( {"gps": [10, 10], "location_name": "school"}, - {"latitude": 10, "longitude": 10, "gps_accuracy": 30}, + {"latitude": 10, "longitude": 10, "gps_accuracy": 30, "in_zones": []}, "School", ), # Send location_name only - ({"location_name": "home"}, {}, "home"), - ({"location_name": "office"}, {}, "Office"), - ({"location_name": "school"}, {}, "School"), + ({"location_name": "home"}, {"in_zones": []}, "home"), + ({"location_name": "office"}, {"in_zones": []}, "Office"), + ({"location_name": "school"}, {"in_zones": []}, "School"), # Send coordinates only - location is determined by coordinates ( {"gps": [10, 20]}, - {"latitude": 10, "longitude": 20, "gps_accuracy": 30}, + { + "latitude": 10, + "longitude": 20, + "gps_accuracy": 30, + "in_zones": ["zone.home"], + }, "home", ), ( {"gps": [20, 30]}, - {"latitude": 20, "longitude": 30, "gps_accuracy": 30}, + { + "latitude": 20, + "longitude": 30, + "gps_accuracy": 30, + "in_zones": ["zone.office"], + }, "Office", ), ( {"gps": [30, 40]}, - {"latitude": 30, "longitude": 40, "gps_accuracy": 30}, + { + "latitude": 30, + "longitude": 40, + "gps_accuracy": 30, + "in_zones": ["zone.school"], + }, "School", ), ], @@ -180,6 +210,7 @@ async def test_sending_location( "course": 6, "speed": 7, "vertical_accuracy": 8, + "in_zones": [], } diff --git a/tests/components/mqtt/test_diagnostics.py b/tests/components/mqtt/test_diagnostics.py index 5db0340eb2c..c669a86b112 100644 --- a/tests/components/mqtt/test_diagnostics.py +++ b/tests/components/mqtt/test_diagnostics.py @@ -239,6 +239,7 @@ async def test_redact_diagnostics( "state": { "attributes": { "gps_accuracy": 1.5, + "in_zones": ["zone.home"], "latitude": "**REDACTED**", "longitude": "**REDACTED**", "source_type": "gps",