2018-02-25 09:58:13 +00:00
|
|
|
"""Tests for the HomeKit component."""
|
2018-05-10 23:21:59 +00:00
|
|
|
from unittest.mock import patch, ANY, Mock
|
|
|
|
|
|
|
|
import pytest
|
2018-03-01 23:20:02 +00:00
|
|
|
|
2018-02-19 22:46:22 +00:00
|
|
|
from homeassistant import setup
|
2019-07-16 01:43:37 +00:00
|
|
|
|
2018-05-04 14:46:00 +00:00
|
|
|
from homeassistant.components.homekit import (
|
2019-07-31 19:25:30 +00:00
|
|
|
generate_aid,
|
|
|
|
HomeKit,
|
|
|
|
MAX_DEVICES,
|
|
|
|
STATUS_READY,
|
|
|
|
STATUS_RUNNING,
|
|
|
|
STATUS_STOPPED,
|
|
|
|
STATUS_WAIT,
|
|
|
|
)
|
2018-03-15 01:48:21 +00:00
|
|
|
from homeassistant.components.homekit.accessories import HomeBridge
|
|
|
|
from homeassistant.components.homekit.const import (
|
2019-07-31 19:25:30 +00:00
|
|
|
CONF_AUTO_START,
|
|
|
|
CONF_SAFE_MODE,
|
|
|
|
BRIDGE_NAME,
|
|
|
|
DEFAULT_PORT,
|
|
|
|
DEFAULT_SAFE_MODE,
|
|
|
|
DOMAIN,
|
|
|
|
HOMEKIT_FILE,
|
|
|
|
SERVICE_HOMEKIT_START,
|
|
|
|
SERVICE_HOMEKIT_RESET_ACCESSORY,
|
|
|
|
)
|
2018-02-19 22:46:22 +00:00
|
|
|
from homeassistant.const import (
|
2019-07-31 19:25:30 +00:00
|
|
|
ATTR_ENTITY_ID,
|
|
|
|
CONF_NAME,
|
|
|
|
CONF_IP_ADDRESS,
|
|
|
|
CONF_PORT,
|
|
|
|
EVENT_HOMEASSISTANT_START,
|
|
|
|
EVENT_HOMEASSISTANT_STOP,
|
|
|
|
)
|
2018-06-17 11:37:44 +00:00
|
|
|
from homeassistant.core import State
|
|
|
|
from homeassistant.helpers.entityfilter import generate_filter
|
2018-02-19 22:46:22 +00:00
|
|
|
|
2018-05-21 02:25:53 +00:00
|
|
|
from tests.components.homekit.common import patch_debounce
|
2018-02-19 22:46:22 +00:00
|
|
|
|
2019-07-16 01:43:37 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
IP_ADDRESS = "127.0.0.1"
|
|
|
|
PATH_HOMEKIT = "homeassistant.components.homekit"
|
2018-02-19 22:46:22 +00:00
|
|
|
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
@pytest.fixture(scope="module")
|
2018-05-21 02:25:53 +00:00
|
|
|
def debounce_patcher():
|
2018-05-10 23:21:59 +00:00
|
|
|
"""Patch debounce method."""
|
|
|
|
patcher = patch_debounce()
|
2018-05-21 02:25:53 +00:00
|
|
|
yield patcher.start()
|
|
|
|
patcher.stop()
|
2018-02-19 22:46:22 +00:00
|
|
|
|
2018-04-06 21:11:53 +00:00
|
|
|
|
2018-05-10 23:21:59 +00:00
|
|
|
def test_generate_aid():
|
|
|
|
"""Test generate aid method."""
|
2019-07-31 19:25:30 +00:00
|
|
|
aid = generate_aid("demo.entity")
|
2018-05-10 23:21:59 +00:00
|
|
|
assert isinstance(aid, int)
|
|
|
|
assert aid >= 2 and aid <= 18446744073709551615
|
2018-04-06 21:11:53 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(PATH_HOMEKIT + ".adler32") as mock_adler32:
|
2018-05-10 23:21:59 +00:00
|
|
|
mock_adler32.side_effect = [0, 1]
|
2019-07-31 19:25:30 +00:00
|
|
|
assert generate_aid("demo.entity") is None
|
2018-02-19 22:46:22 +00:00
|
|
|
|
|
|
|
|
2018-05-10 23:21:59 +00:00
|
|
|
async def test_setup_min(hass):
|
|
|
|
"""Test async_setup with min config options."""
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(PATH_HOMEKIT + ".HomeKit") as mock_homekit:
|
|
|
|
assert await setup.async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
2018-03-01 23:20:02 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_homekit.assert_any_call(
|
2019-10-23 05:06:21 +00:00
|
|
|
hass, BRIDGE_NAME, DEFAULT_PORT, None, ANY, {}, DEFAULT_SAFE_MODE, None
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2018-05-10 23:21:59 +00:00
|
|
|
assert mock_homekit().setup.called is True
|
2018-02-19 22:46:22 +00:00
|
|
|
|
2018-05-10 23:21:59 +00:00
|
|
|
# Test auto start enabled
|
|
|
|
mock_homekit.reset_mock()
|
|
|
|
hass.bus.async_fire(EVENT_HOMEASSISTANT_START)
|
|
|
|
await hass.async_block_till_done()
|
2018-02-19 22:46:22 +00:00
|
|
|
|
2018-05-10 23:21:59 +00:00
|
|
|
mock_homekit().start.assert_called_with(ANY)
|
2018-02-19 22:46:22 +00:00
|
|
|
|
|
|
|
|
2018-05-10 23:21:59 +00:00
|
|
|
async def test_setup_auto_start_disabled(hass):
|
|
|
|
"""Test async_setup with auto start disabled and test service calls."""
|
2019-07-31 19:25:30 +00:00
|
|
|
config = {
|
|
|
|
DOMAIN: {
|
|
|
|
CONF_AUTO_START: False,
|
|
|
|
CONF_NAME: "Test Name",
|
|
|
|
CONF_PORT: 11111,
|
|
|
|
CONF_IP_ADDRESS: "172.0.0.0",
|
|
|
|
CONF_SAFE_MODE: DEFAULT_SAFE_MODE,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
with patch(PATH_HOMEKIT + ".HomeKit") as mock_homekit:
|
2018-03-15 01:48:21 +00:00
|
|
|
mock_homekit.return_value = homekit = Mock()
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await setup.async_setup_component(hass, DOMAIN, config)
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_homekit.assert_any_call(
|
2019-10-23 05:06:21 +00:00
|
|
|
hass, "Test Name", 11111, "172.0.0.0", ANY, {}, DEFAULT_SAFE_MODE, None
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2018-05-10 23:21:59 +00:00
|
|
|
assert mock_homekit().setup.called is True
|
|
|
|
|
|
|
|
# Test auto_start disabled
|
|
|
|
homekit.reset_mock()
|
|
|
|
hass.bus.async_fire(EVENT_HOMEASSISTANT_START)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
assert homekit.start.called is False
|
|
|
|
|
|
|
|
# Test start call with driver is ready
|
|
|
|
homekit.reset_mock()
|
|
|
|
homekit.status = STATUS_READY
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
await hass.services.async_call(DOMAIN, SERVICE_HOMEKIT_START, blocking=True)
|
2018-05-10 23:21:59 +00:00
|
|
|
assert homekit.start.called is True
|
|
|
|
|
|
|
|
# Test start call with driver started
|
|
|
|
homekit.reset_mock()
|
|
|
|
homekit.status = STATUS_STOPPED
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
await hass.services.async_call(DOMAIN, SERVICE_HOMEKIT_START, blocking=True)
|
2018-05-10 23:21:59 +00:00
|
|
|
assert homekit.start.called is False
|
|
|
|
|
|
|
|
|
2018-05-29 20:43:26 +00:00
|
|
|
async def test_homekit_setup(hass, hk_driver):
|
2018-05-10 23:21:59 +00:00
|
|
|
"""Test setup of bridge and driver."""
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit = HomeKit(hass, BRIDGE_NAME, DEFAULT_PORT, None, {}, {}, DEFAULT_SAFE_MODE)
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(
|
|
|
|
PATH_HOMEKIT + ".accessories.HomeDriver", return_value=hk_driver
|
|
|
|
) as mock_driver, patch("homeassistant.util.get_local_ip") as mock_ip:
|
2018-05-10 23:21:59 +00:00
|
|
|
mock_ip.return_value = IP_ADDRESS
|
|
|
|
await hass.async_add_job(homekit.setup)
|
|
|
|
|
|
|
|
path = hass.config.path(HOMEKIT_FILE)
|
|
|
|
assert isinstance(homekit.bridge, HomeBridge)
|
|
|
|
mock_driver.assert_called_with(
|
2019-10-23 05:06:21 +00:00
|
|
|
hass,
|
|
|
|
address=IP_ADDRESS,
|
|
|
|
port=DEFAULT_PORT,
|
|
|
|
persist_file=path,
|
|
|
|
advertised_address=None,
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2018-11-16 10:08:39 +00:00
|
|
|
assert homekit.driver.safe_mode is False
|
2018-05-10 23:21:59 +00:00
|
|
|
|
|
|
|
# Test if stop listener is setup
|
|
|
|
assert hass.bus.async_listeners().get(EVENT_HOMEASSISTANT_STOP) == 1
|
|
|
|
|
|
|
|
|
2018-05-29 20:43:26 +00:00
|
|
|
async def test_homekit_setup_ip_address(hass, hk_driver):
|
2018-05-10 23:21:59 +00:00
|
|
|
"""Test setup with given IP address."""
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit = HomeKit(hass, BRIDGE_NAME, DEFAULT_PORT, "172.0.0.0", {}, {}, None)
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(
|
|
|
|
PATH_HOMEKIT + ".accessories.HomeDriver", return_value=hk_driver
|
|
|
|
) as mock_driver:
|
2018-05-10 23:21:59 +00:00
|
|
|
await hass.async_add_job(homekit.setup)
|
2018-05-18 14:32:57 +00:00
|
|
|
mock_driver.assert_called_with(
|
2019-10-23 05:06:21 +00:00
|
|
|
hass,
|
|
|
|
address="172.0.0.0",
|
|
|
|
port=DEFAULT_PORT,
|
|
|
|
persist_file=ANY,
|
|
|
|
advertised_address=None,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
async def test_homekit_setup_advertise_ip(hass, hk_driver):
|
|
|
|
"""Test setup with given IP address to advertise."""
|
|
|
|
homekit = HomeKit(
|
|
|
|
hass, BRIDGE_NAME, DEFAULT_PORT, "0.0.0.0", {}, {}, None, "192.168.1.100"
|
|
|
|
)
|
|
|
|
|
|
|
|
with patch(
|
|
|
|
PATH_HOMEKIT + ".accessories.HomeDriver", return_value=hk_driver
|
|
|
|
) as mock_driver:
|
|
|
|
await hass.async_add_job(homekit.setup)
|
|
|
|
mock_driver.assert_called_with(
|
|
|
|
hass,
|
|
|
|
address="0.0.0.0",
|
|
|
|
port=DEFAULT_PORT,
|
|
|
|
persist_file=ANY,
|
|
|
|
advertised_address="192.168.1.100",
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2018-05-10 23:21:59 +00:00
|
|
|
|
|
|
|
|
2018-11-16 10:08:39 +00:00
|
|
|
async def test_homekit_setup_safe_mode(hass, hk_driver):
|
|
|
|
"""Test if safe_mode flag is set."""
|
|
|
|
homekit = HomeKit(hass, BRIDGE_NAME, DEFAULT_PORT, None, {}, {}, True)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(PATH_HOMEKIT + ".accessories.HomeDriver", return_value=hk_driver):
|
2018-11-16 10:08:39 +00:00
|
|
|
await hass.async_add_job(homekit.setup)
|
|
|
|
assert homekit.driver.safe_mode is True
|
|
|
|
|
|
|
|
|
2018-05-21 02:25:53 +00:00
|
|
|
async def test_homekit_add_accessory():
|
2018-05-10 23:21:59 +00:00
|
|
|
"""Add accessory if config exists and get_acc returns an accessory."""
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit = HomeKit("hass", None, None, None, lambda entity_id: True, {}, None)
|
|
|
|
homekit.driver = "driver"
|
2018-05-21 02:25:53 +00:00
|
|
|
homekit.bridge = mock_bridge = Mock()
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(PATH_HOMEKIT + ".get_accessory") as mock_get_acc:
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_get_acc.side_effect = [None, "acc", None]
|
|
|
|
homekit.add_bridge_accessory(State("light.demo", "on"))
|
|
|
|
mock_get_acc.assert_called_with("hass", "driver", ANY, 363398124, {})
|
2018-05-21 02:25:53 +00:00
|
|
|
assert not mock_bridge.add_accessory.called
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit.add_bridge_accessory(State("demo.test", "on"))
|
|
|
|
mock_get_acc.assert_called_with("hass", "driver", ANY, 294192020, {})
|
2018-05-21 02:25:53 +00:00
|
|
|
assert mock_bridge.add_accessory.called
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit.add_bridge_accessory(State("demo.test_2", "on"))
|
|
|
|
mock_get_acc.assert_called_with("hass", "driver", ANY, 429982757, {})
|
|
|
|
mock_bridge.add_accessory.assert_called_with("acc")
|
2018-05-10 23:21:59 +00:00
|
|
|
|
|
|
|
|
2019-07-16 01:43:37 +00:00
|
|
|
async def test_homekit_remove_accessory():
|
|
|
|
"""Remove accessory from bridge."""
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit = HomeKit("hass", None, None, None, lambda entity_id: True, {}, None)
|
|
|
|
homekit.driver = "driver"
|
2019-07-16 01:43:37 +00:00
|
|
|
homekit.bridge = mock_bridge = Mock()
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_bridge.accessories = {"light.demo": "acc"}
|
2019-07-16 01:43:37 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
acc = homekit.remove_bridge_accessory("light.demo")
|
|
|
|
assert acc == "acc"
|
2019-07-16 01:43:37 +00:00
|
|
|
assert len(mock_bridge.accessories) == 0
|
|
|
|
|
|
|
|
|
2018-05-10 23:21:59 +00:00
|
|
|
async def test_homekit_entity_filter(hass):
|
|
|
|
"""Test the entity filter."""
|
2019-07-31 19:25:30 +00:00
|
|
|
entity_filter = generate_filter(["cover"], ["demo.test"], [], [])
|
2018-11-16 10:08:39 +00:00
|
|
|
homekit = HomeKit(hass, None, None, None, entity_filter, {}, None)
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(PATH_HOMEKIT + ".get_accessory") as mock_get_acc:
|
2018-05-10 23:21:59 +00:00
|
|
|
mock_get_acc.return_value = None
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit.add_bridge_accessory(State("cover.test", "open"))
|
2018-05-10 23:21:59 +00:00
|
|
|
assert mock_get_acc.called is True
|
|
|
|
mock_get_acc.reset_mock()
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit.add_bridge_accessory(State("demo.test", "on"))
|
2018-05-10 23:21:59 +00:00
|
|
|
assert mock_get_acc.called is True
|
|
|
|
mock_get_acc.reset_mock()
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit.add_bridge_accessory(State("light.demo", "light"))
|
2018-05-10 23:21:59 +00:00
|
|
|
assert mock_get_acc.called is False
|
|
|
|
|
|
|
|
|
2018-05-29 20:43:26 +00:00
|
|
|
async def test_homekit_start(hass, hk_driver, debounce_patcher):
|
2018-05-10 23:21:59 +00:00
|
|
|
"""Test HomeKit start method."""
|
2019-07-31 19:25:30 +00:00
|
|
|
pin = b"123-45-678"
|
|
|
|
homekit = HomeKit(hass, None, None, None, {}, {"cover.demo": {}}, None)
|
2018-10-05 10:32:26 +00:00
|
|
|
homekit.bridge = Mock()
|
|
|
|
homekit.bridge.accessories = []
|
2018-05-29 20:43:26 +00:00
|
|
|
homekit.driver = hk_driver
|
2018-05-10 23:21:59 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
hass.states.async_set("light.demo", "on")
|
2018-05-10 23:21:59 +00:00
|
|
|
state = hass.states.async_all()[0]
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(PATH_HOMEKIT + ".HomeKit.add_bridge_accessory") as mock_add_acc, patch(
|
|
|
|
PATH_HOMEKIT + ".show_setup_message"
|
|
|
|
) as mock_setup_msg, patch(
|
|
|
|
"pyhap.accessory_driver.AccessoryDriver.add_accessory"
|
|
|
|
) as hk_driver_add_acc, patch(
|
|
|
|
"pyhap.accessory_driver.AccessoryDriver.start"
|
|
|
|
) as hk_driver_start:
|
2018-05-10 23:21:59 +00:00
|
|
|
await hass.async_add_job(homekit.start)
|
|
|
|
|
|
|
|
mock_add_acc.assert_called_with(state)
|
2018-05-18 14:32:57 +00:00
|
|
|
mock_setup_msg.assert_called_with(hass, pin)
|
2018-10-05 10:32:26 +00:00
|
|
|
hk_driver_add_acc.assert_called_with(homekit.bridge)
|
2018-05-29 20:43:26 +00:00
|
|
|
assert hk_driver_start.called
|
2018-05-10 23:21:59 +00:00
|
|
|
assert homekit.status == STATUS_RUNNING
|
|
|
|
|
|
|
|
# Test start() if already started
|
2018-05-29 20:43:26 +00:00
|
|
|
hk_driver_start.reset_mock()
|
2018-05-10 23:21:59 +00:00
|
|
|
await hass.async_add_job(homekit.start)
|
2018-05-29 20:43:26 +00:00
|
|
|
assert not hk_driver_start.called
|
2018-05-10 23:21:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_homekit_stop(hass):
|
|
|
|
"""Test HomeKit stop method."""
|
2018-11-16 10:08:39 +00:00
|
|
|
homekit = HomeKit(hass, None, None, None, None, None, None)
|
2018-05-10 23:21:59 +00:00
|
|
|
homekit.driver = Mock()
|
|
|
|
|
|
|
|
assert homekit.status == STATUS_READY
|
|
|
|
await hass.async_add_job(homekit.stop)
|
|
|
|
homekit.status = STATUS_WAIT
|
|
|
|
await hass.async_add_job(homekit.stop)
|
|
|
|
homekit.status = STATUS_STOPPED
|
|
|
|
await hass.async_add_job(homekit.stop)
|
|
|
|
assert homekit.driver.stop.called is False
|
2018-03-15 01:48:21 +00:00
|
|
|
|
2018-05-10 23:21:59 +00:00
|
|
|
# Test if driver is started
|
|
|
|
homekit.status = STATUS_RUNNING
|
|
|
|
await hass.async_add_job(homekit.stop)
|
|
|
|
assert homekit.driver.stop.called is True
|
2018-10-05 10:32:26 +00:00
|
|
|
|
|
|
|
|
2019-07-16 01:43:37 +00:00
|
|
|
async def test_homekit_reset_accessories(hass):
|
|
|
|
"""Test adding too many accessories to HomeKit."""
|
2019-07-31 19:25:30 +00:00
|
|
|
entity_id = "light.demo"
|
2019-07-16 01:43:37 +00:00
|
|
|
homekit = HomeKit(hass, None, None, None, {}, {entity_id: {}}, None)
|
|
|
|
homekit.bridge = Mock()
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch(PATH_HOMEKIT + ".HomeKit", return_value=homekit), patch(
|
|
|
|
PATH_HOMEKIT + ".HomeKit.setup"
|
|
|
|
), patch("pyhap.accessory.Bridge.add_accessory") as mock_add_accessory, patch(
|
|
|
|
"pyhap.accessory_driver.AccessoryDriver.config_changed"
|
|
|
|
) as hk_driver_config_changed:
|
2019-07-16 01:43:37 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await setup.async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
2019-07-16 01:43:37 +00:00
|
|
|
|
|
|
|
aid = generate_aid(entity_id)
|
2019-07-31 19:25:30 +00:00
|
|
|
homekit.bridge.accessories = {aid: "acc"}
|
2019-07-16 01:43:37 +00:00
|
|
|
homekit.status = STATUS_RUNNING
|
|
|
|
|
|
|
|
await hass.services.async_call(
|
2019-07-31 19:25:30 +00:00
|
|
|
DOMAIN,
|
|
|
|
SERVICE_HOMEKIT_RESET_ACCESSORY,
|
|
|
|
{ATTR_ENTITY_ID: entity_id},
|
|
|
|
blocking=True,
|
|
|
|
)
|
2019-07-16 01:43:37 +00:00
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
assert 2 == hk_driver_config_changed.call_count
|
|
|
|
assert mock_add_accessory.called
|
|
|
|
homekit.status = STATUS_READY
|
|
|
|
|
|
|
|
|
2018-10-05 10:32:26 +00:00
|
|
|
async def test_homekit_too_many_accessories(hass, hk_driver):
|
|
|
|
"""Test adding too many accessories to HomeKit."""
|
2018-11-16 10:08:39 +00:00
|
|
|
homekit = HomeKit(hass, None, None, None, None, None, None)
|
2018-10-05 10:32:26 +00:00
|
|
|
homekit.bridge = Mock()
|
|
|
|
homekit.bridge.accessories = range(MAX_DEVICES + 1)
|
|
|
|
homekit.driver = hk_driver
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch("pyhap.accessory_driver.AccessoryDriver.start"), patch(
|
|
|
|
"pyhap.accessory_driver.AccessoryDriver.add_accessory"
|
|
|
|
), patch("homeassistant.components.homekit._LOGGER.warning") as mock_warn:
|
2018-10-05 10:32:26 +00:00
|
|
|
await hass.async_add_job(homekit.start)
|
|
|
|
assert mock_warn.called is True
|