diff --git a/tests/components/nextdns/test_binary_sensor.py b/tests/components/nextdns/test_binary_sensor.py index f83e55515e8..19cad755fb4 100644 --- a/tests/components/nextdns/test_binary_sensor.py +++ b/tests/components/nextdns/test_binary_sensor.py @@ -13,7 +13,7 @@ from homeassistant.util.dt import utcnow from . import init_integration, mock_nextdns -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, snapshot_platform async def test_binary_sensor( @@ -23,13 +23,7 @@ async def test_binary_sensor( with patch("homeassistant.components.nextdns.PLATFORMS", [Platform.BINARY_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_availability(hass: HomeAssistant) -> None: diff --git a/tests/components/nextdns/test_button.py b/tests/components/nextdns/test_button.py index 2007af612c8..51970b9bb48 100644 --- a/tests/components/nextdns/test_button.py +++ b/tests/components/nextdns/test_button.py @@ -12,6 +12,8 @@ from homeassistant.util import dt as dt_util from . import init_integration +from tests.common import snapshot_platform + async def test_button( hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion @@ -20,13 +22,7 @@ async def test_button( with patch("homeassistant.components.nextdns.PLATFORMS", [Platform.BUTTON]): 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_button_press(hass: HomeAssistant) -> None: diff --git a/tests/components/nextdns/test_sensor.py b/tests/components/nextdns/test_sensor.py index 9c03cf2b215..e7ea7a3f56b 100644 --- a/tests/components/nextdns/test_sensor.py +++ b/tests/components/nextdns/test_sensor.py @@ -13,7 +13,7 @@ from homeassistant.util.dt import utcnow from . import init_integration, mock_nextdns -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, snapshot_platform async def test_sensor( @@ -26,13 +26,7 @@ async def test_sensor( with patch("homeassistant.components.nextdns.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_availability( diff --git a/tests/components/nextdns/test_switch.py b/tests/components/nextdns/test_switch.py index 5e027c6789c..2936bad1c67 100644 --- a/tests/components/nextdns/test_switch.py +++ b/tests/components/nextdns/test_switch.py @@ -26,7 +26,7 @@ from homeassistant.util.dt import utcnow from . import init_integration, mock_nextdns -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, snapshot_platform async def test_switch( @@ -39,13 +39,7 @@ async def test_switch( with patch("homeassistant.components.nextdns.PLATFORMS", [Platform.SWITCH]): 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_switch_on(hass: HomeAssistant) -> None: