Use registry fixtures in tests (m-n) (#118291)

This commit is contained in:
epenet
2024-05-28 13:40:45 +02:00
committed by GitHub
parent 8837c50da7
commit ead0e797c1
22 changed files with 185 additions and 166 deletions

View File

@@ -142,7 +142,9 @@ async def test_unknown_state_sensors(hass: HomeAssistant) -> None:
assert state2.state == "OQ"
async def test_stale_options(hass: HomeAssistant) -> None:
async def test_stale_options(
hass: HomeAssistant, entity_registry: er.EntityRegistry
) -> None:
"""Test creation of sensors with stale options to remove."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@@ -166,8 +168,7 @@ async def test_stale_options(hass: HomeAssistant) -> None:
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
registry = er.async_get(hass)
entry = registry.async_get("sensor.ups1_battery_charge")
entry = entity_registry.async_get("sensor.ups1_battery_charge")
assert entry
assert entry.unique_id == f"{config_entry.entry_id}_battery.charge"
assert config_entry.data[CONF_RESOURCES] == ["battery.charge"]