From 5e345b7129b01d89b98589153374d98924e31804 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Sat, 20 Apr 2024 18:43:33 +0200 Subject: [PATCH] Use snapshot test helper in NAM (#115894) Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com> --- tests/components/nam/test_sensor.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/components/nam/test_sensor.py b/tests/components/nam/test_sensor.py index 5254c444434..2b307b4b02a 100644 --- a/tests/components/nam/test_sensor.py +++ b/tests/components/nam/test_sensor.py @@ -24,7 +24,11 @@ from homeassistant.util.dt import utcnow from . import INCOMPLETE_NAM_DATA, init_integration -from tests.common import async_fire_time_changed, load_json_object_fixture +from tests.common import ( + async_fire_time_changed, + load_json_object_fixture, + snapshot_platform, +) async def test_sensor( @@ -41,13 +45,7 @@ async def test_sensor( with patch("homeassistant.components.nam.PLATFORMS", [Platform.SENSOR]): entry = await init_integration(hass) - entity_entries = er.async_entries_for_config_entry(entity_registry, entry.entry_id) - - assert entity_entries - for entity_entry in entity_entries: - assert entity_entry == snapshot(name=f"{entity_entry.entity_id}-entry") - assert (state := hass.states.get(entity_entry.entity_id)) - assert state == snapshot(name=f"{entity_entry.entity_id}-state") + await snapshot_platform(hass, entity_registry, snapshot, entry.entry_id) async def test_sensor_disabled(