Use entry ID when IPP printer offers no identifier (#34316)

This commit is contained in:
Chris Talkington authored and Paulus Schoutsen committed 2020-04-30 00:22:05 -07:00
1 parent 38f9559348
commit ade4e36da7
4 files changed
+50 -19

No files matched your search

+12
View File
@@ -94,3 +94,15 @@ async def test_disabled_by_default_sensors(
assert entry
assert entry.disabled
assert entry.disabled_by == "integration"
async def test_missing_entry_unique_id(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
"""Test the unique_id of IPP sensor when printer is missing identifiers."""
entry = await init_integration(hass, aioclient_mock, uuid=None, unique_id=None)
registry = await hass.helpers.entity_registry.async_get_registry()
entity = registry.async_get("sensor.epson_xp_6000_series")
assert entity
assert entity.unique_id == f"{entry.entry_id}_printer"