Update honeywell device cleanup test (#178441)

This commit is contained in:
Erik Montnemery
2026-08-07 13:33:25 +02:00
committed by GitHub
parent 90550e3f4d
commit 875e06249e
-47
View File
@@ -162,23 +162,7 @@ async def test_remove_stale_device(
"""Test that the stale device is removed."""
location.devices_by_id[another_device.deviceid] = another_device
config_entry_other = MockConfigEntry(
domain="OtherDomain",
data={},
unique_id="unique_id",
)
config_entry_other.add_to_hass(hass)
device_entry_other = device_registry.async_get_or_create(
config_entry_id=config_entry_other.entry_id,
identifiers={("OtherDomain", 7654321)},
)
config_entry.add_to_hass(hass)
device_registry.async_update_device(
device_entry_other.id,
add_config_entry_id=config_entry.entry_id,
merge_identifiers={(DOMAIN, 7654321)},
)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
@@ -188,28 +172,9 @@ async def test_remove_stale_device(
device_entries = dr.async_entries_for_config_entry(
device_registry, config_entry.entry_id
)
device_entries_other = dr.async_entries_for_config_entry(
device_registry, config_entry_other.entry_id
)
assert len(device_entries) == 2
assert any((DOMAIN, 1234567) in device.identifiers for device in device_entries)
assert any((DOMAIN, 7654321) in device.identifiers for device in device_entries)
# Identifiers are unique per config entry, so Honeywell and OtherDomain have
# separate devices for 7654321; Honeywell's devices do not carry the OtherDomain
# identifier
assert not any(
("OtherDomain", 7654321) in device.identifiers for device in device_entries
)
assert len(device_entries_other) == 1
assert any(
("OtherDomain", 7654321) in device.identifiers
for device in device_entries_other
)
assert any(
(DOMAIN, 7654321) in device.identifiers for device in device_entries_other
)
assert await hass.config_entries.async_unload(config_entry.entry_id)
await hass.async_block_till_done()
@@ -233,15 +198,3 @@ async def test_remove_stale_device(
assert len(device_entries) == 1
assert any((DOMAIN, 1234567) in device.identifiers for device in device_entries)
assert not any((DOMAIN, 7654321) in device.identifiers for device in device_entries)
assert not any(
("OtherDomain", 7654321) in device.identifiers for device in device_entries
)
device_entries_other = dr.async_entries_for_config_entry(
device_registry, config_entry_other.entry_id
)
assert len(device_entries_other) == 1
assert any(
("OtherDomain", 7654321) in device.identifiers
for device in device_entries_other
)