Update test_device_cleaning in Template (#120163)

This commit is contained in:
dougiteixeira 2024-06-22 10:59:46 -03:00 committed by GitHub
parent 02f0050819
commit 10edf85311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 13 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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