Final clean up of helpers accessed via hass (#72032)

* Final clean up of helpers accessed via hass

* Fix circular dep

* Fix import
This commit is contained in:
Franck Nijhof 2022-05-17 22:42:37 +02:00 committed by GitHub
parent d1d6c6b923
commit bfb47eb212
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 75 additions and 82 deletions

View file

@ -49,7 +49,7 @@ from homeassistant.const import (
STATE_ON,
)
from homeassistant.core import HomeAssistantError, State
from homeassistant.helpers import device_registry, entity_registry as er
from homeassistant.helpers import device_registry, entity_registry as er, instance_id
from homeassistant.helpers.entityfilter import (
CONF_EXCLUDE_DOMAINS,
CONF_EXCLUDE_ENTITIES,
@ -201,7 +201,7 @@ async def test_homekit_setup(hass, hk_driver, mock_async_zeroconf):
hass.states.async_set("light.demo", "on")
hass.states.async_set("light.demo2", "on")
zeroconf_mock = MagicMock()
uuid = await hass.helpers.instance_id.async_get()
uuid = await instance_id.async_get(hass)
with patch(f"{PATH_HOMEKIT}.HomeDriver", return_value=hk_driver) as mock_driver:
await hass.async_add_executor_job(homekit.setup, zeroconf_mock, uuid)
@ -245,7 +245,7 @@ async def test_homekit_setup_ip_address(hass, hk_driver, mock_async_zeroconf):
)
path = get_persist_fullpath_for_entry_id(hass, entry.entry_id)
uuid = await hass.helpers.instance_id.async_get()
uuid = await instance_id.async_get(hass)
with patch(f"{PATH_HOMEKIT}.HomeDriver", return_value=hk_driver) as mock_driver:
await hass.async_add_executor_job(homekit.setup, mock_async_zeroconf, uuid)
mock_driver.assert_called_with(
@ -287,7 +287,7 @@ async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_async_zeroconf):
async_zeroconf_instance = MagicMock()
path = get_persist_fullpath_for_entry_id(hass, entry.entry_id)
uuid = await hass.helpers.instance_id.async_get()
uuid = await instance_id.async_get(hass)
with patch(f"{PATH_HOMEKIT}.HomeDriver", return_value=hk_driver) as mock_driver:
await hass.async_add_executor_job(homekit.setup, async_zeroconf_instance, uuid)
mock_driver.assert_called_with(