Implement PlatformNotReady on onewire integration (#42395)

This commit is contained in:
epenet authored and GitHub committed 2020-10-26 16:33:13 +01:00
1 parent 935c2df7cb
commit 0de52c173c
6 files changed
+146 -47

No files matched your search

+8 -3
View File
@@ -2,6 +2,7 @@
from asynctest.mock import patch
from homeassistant.components.onewire.const import (
CONF_MOUNT_DIR,
CONF_TYPE_OWSERVER,
CONF_TYPE_SYSBUS,
DEFAULT_SYSBUS_MOUNT_DIR,
@@ -20,6 +21,7 @@ async def setup_onewire_sysbus_integration(hass):
source="user",
data={
CONF_TYPE: CONF_TYPE_SYSBUS,
CONF_MOUNT_DIR: DEFAULT_SYSBUS_MOUNT_DIR,
},
unique_id=f"{CONF_TYPE_SYSBUS}:{DEFAULT_SYSBUS_MOUNT_DIR}",
connection_class=CONN_CLASS_LOCAL_POLL,
@@ -28,8 +30,11 @@ async def setup_onewire_sysbus_integration(hass):
)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
with patch(
"homeassistant.components.onewire.onewirehub.os.path.isdir", return_value=True
):
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
return config_entry
@@ -52,7 +57,7 @@ async def setup_onewire_owserver_integration(hass):
config_entry.add_to_hass(hass)
with patch(
"homeassistant.components.onewire.sensor.protocol.proxy",
"homeassistant.components.onewire.onewirehub.protocol.proxy",
):
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()