Use registry fixtures in tests (r) (#118293)

This commit is contained in:
epenet
2024-05-28 14:23:31 +02:00
committed by GitHub
parent 2545b7d3bb
commit 8d8696075b
30 changed files with 234 additions and 180 deletions

View File

@@ -480,7 +480,9 @@ async def test_default_keepalive(
assert "TCP Keepalive IDLE timer was provided" not in caplog.text
async def test_unique_id(hass: HomeAssistant, monkeypatch) -> None:
async def test_unique_id(
hass: HomeAssistant, entity_registry: er.EntityRegistry, monkeypatch
) -> None:
"""Validate the device unique_id."""
DOMAIN = "sensor"
@@ -503,15 +505,13 @@ async def test_unique_id(hass: HomeAssistant, monkeypatch) -> None:
},
}
registry = er.async_get(hass)
# setup mocking rflink module
event_callback, _, _, _ = await mock_rflink(hass, config, DOMAIN, monkeypatch)
humidity_entry = registry.async_get("sensor.humidity_device")
humidity_entry = entity_registry.async_get("sensor.humidity_device")
assert humidity_entry
assert humidity_entry.unique_id == "my_humidity_device_unique_id"
temperature_entry = registry.async_get("sensor.temperature_device")
temperature_entry = entity_registry.async_get("sensor.temperature_device")
assert temperature_entry
assert temperature_entry.unique_id == "my_temperature_device_unique_id"