Use snapshot test helper in Analytics insights (#115889)

This commit is contained in:
Joost Lekkerkerker 2024-04-20 21:27:54 +02:00 committed by GitHub
parent c94b0a82ca
commit ee116713cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,7 @@ from homeassistant.helpers import entity_registry as er
from . import setup_integration
from tests.common import MockConfigEntry, async_fire_time_changed
from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_platform
async def test_all_entities(
@ -32,17 +32,10 @@ async def test_all_entities(
[Platform.SENSOR],
):
await setup_integration(hass, mock_config_entry)
entity_entries = er.async_entries_for_config_entry(
entity_registry, mock_config_entry.entry_id
await snapshot_platform(
hass, entity_registry, snapshot, mock_config_entry.entry_id
)
assert entity_entries
for entity_entry in entity_entries:
assert hass.states.get(entity_entry.entity_id) == snapshot(
name=f"{entity_entry.entity_id}-state"
)
assert entity_entry == snapshot(name=f"{entity_entry.entity_id}-entry")
async def test_connection_error(
hass: HomeAssistant,