Fix device name customization on ZHA add devices page (#25180)
* ensure new device exists * clean up dev reg handling * update test * fix tests
This commit is contained in:
parent
56841da2d3
commit
ac91423d71
3 changed files with 31 additions and 13 deletions
|
@ -5,6 +5,8 @@ from homeassistant import config_entries
|
|||
from homeassistant.components.zha.core.const import (
|
||||
DOMAIN, DATA_ZHA, COMPONENTS
|
||||
)
|
||||
from homeassistant.helpers.device_registry import (
|
||||
async_get_registry as get_dev_reg)
|
||||
from homeassistant.components.zha.core.gateway import ZHAGateway
|
||||
from homeassistant.components.zha.core.registries import \
|
||||
establish_device_mappings
|
||||
|
@ -24,7 +26,7 @@ def config_entry_fixture(hass):
|
|||
|
||||
|
||||
@pytest.fixture(name='zha_gateway')
|
||||
async def zha_gateway_fixture(hass):
|
||||
async def zha_gateway_fixture(hass, config_entry):
|
||||
"""Fixture representing a zha gateway.
|
||||
|
||||
Create a ZHAGateway object that can be used to interact with as if we
|
||||
|
@ -37,8 +39,10 @@ async def zha_gateway_fixture(hass):
|
|||
hass.data[DATA_ZHA].get(component, {})
|
||||
)
|
||||
zha_storage = await async_get_registry(hass)
|
||||
gateway = ZHAGateway(hass, {})
|
||||
dev_reg = await get_dev_reg(hass)
|
||||
gateway = ZHAGateway(hass, {}, config_entry)
|
||||
gateway.zha_storage = zha_storage
|
||||
gateway.ha_device_registry = dev_reg
|
||||
return gateway
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue