mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Ensure config_entry is added to hass in tests (#120327)
This commit is contained in:
parent
3b79ab6e18
commit
b223cb7bb9
@ -173,14 +173,13 @@ async def test_remove_stale_device(
|
|||||||
identifiers={("OtherDomain", 7654321)},
|
identifiers={("OtherDomain", 7654321)},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
device_registry.async_update_device(
|
device_registry.async_update_device(
|
||||||
device_entry_other.id,
|
device_entry_other.id,
|
||||||
add_config_entry_id=config_entry.entry_id,
|
add_config_entry_id=config_entry.entry_id,
|
||||||
merge_identifiers={(DOMAIN, 7654321)},
|
merge_identifiers={(DOMAIN, 7654321)},
|
||||||
)
|
)
|
||||||
|
|
||||||
config_entry.add_to_hass(hass)
|
|
||||||
|
|
||||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert config_entry.state is ConfigEntryState.LOADED
|
assert config_entry.state is ConfigEntryState.LOADED
|
||||||
|
@ -171,8 +171,10 @@ async def test_device_registry_config_entry_1(
|
|||||||
original_name="ABC",
|
original_name="ABC",
|
||||||
)
|
)
|
||||||
# Add another config entry to the same device
|
# Add another config entry to the same device
|
||||||
|
other_config_entry = MockConfigEntry()
|
||||||
|
other_config_entry.add_to_hass(hass)
|
||||||
device_registry.async_update_device(
|
device_registry.async_update_device(
|
||||||
device_entry.id, add_config_entry_id=MockConfigEntry().entry_id
|
device_entry.id, add_config_entry_id=other_config_entry.entry_id
|
||||||
)
|
)
|
||||||
|
|
||||||
switch_as_x_config_entry = MockConfigEntry(
|
switch_as_x_config_entry = MockConfigEntry(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user