mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Update test_device_cleaning
in Template (#120163)
This commit is contained in:
parent
02f0050819
commit
10edf85311
@ -1405,10 +1405,12 @@ async def test_trigger_entity_restore_state_auto_off_expired(
|
||||
assert state.state == OFF
|
||||
|
||||
|
||||
async def test_device_id(hass: HomeAssistant) -> None:
|
||||
async def test_device_id(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test for device for Template."""
|
||||
device_registry = dr.async_get(hass)
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
device_config_entry = MockConfigEntry()
|
||||
device_config_entry.add_to_hass(hass)
|
||||
|
@ -143,11 +143,10 @@ async def test_config_flow_device(
|
||||
hass: HomeAssistant,
|
||||
template_type: str,
|
||||
state_template: str,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
) -> None:
|
||||
"""Test remove the device registry configuration entry when the device changes."""
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
|
||||
# Configure a device registry
|
||||
entry_device = MockConfigEntry()
|
||||
entry_device.add_to_hass(hass)
|
||||
@ -960,11 +959,10 @@ async def test_options_flow_change_device(
|
||||
hass: HomeAssistant,
|
||||
template_type: str,
|
||||
state_template: str,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
) -> None:
|
||||
"""Test remove the device registry configuration entry when the device changes."""
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
|
||||
# Configure a device registry
|
||||
entry_device1 = MockConfigEntry()
|
||||
entry_device1.add_to_hass(hass)
|
||||
|
@ -271,11 +271,12 @@ async def async_yaml_patch_helper(hass, filename):
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def test_change_device(hass: HomeAssistant) -> None:
|
||||
async def test_change_device(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
) -> None:
|
||||
"""Test remove the device registry configuration entry when the device changes."""
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
|
||||
# Configure a device registry
|
||||
entry_device1 = MockConfigEntry()
|
||||
entry_device1.add_to_hass(hass)
|
||||
|
@ -1898,9 +1898,12 @@ async def test_trigger_action(
|
||||
assert events[0].context.parent_id == context.id
|
||||
|
||||
|
||||
async def test_device_id(hass: HomeAssistant) -> None:
|
||||
async def test_device_id(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test for device for Template."""
|
||||
device_registry = dr.async_get(hass)
|
||||
|
||||
device_config_entry = MockConfigEntry()
|
||||
device_config_entry.add_to_hass(hass)
|
||||
@ -1929,7 +1932,6 @@ async def test_device_id(hass: HomeAssistant) -> None:
|
||||
assert await hass.config_entries.async_setup(template_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
template_entity = entity_registry.async_get("sensor.my_template")
|
||||
assert template_entity is not None
|
||||
assert template_entity.device_id == device_entry.id
|
||||
|
Loading…
x
Reference in New Issue
Block a user