mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 21:10:25 +00:00
Add more HomeKit device enumeration tests (#22194)
* Test that Aqara Gateway, Ecobee 3 and Lennox E30 is correctly enumerated * Move json to fixtures directory * Move IO to executor
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""Code to support homekit_controller tests."""
|
||||
import json
|
||||
import os
|
||||
from datetime import timedelta
|
||||
from unittest import mock
|
||||
|
||||
@@ -13,7 +14,8 @@ from homeassistant.components.homekit_controller.const import (
|
||||
DOMAIN, HOMEKIT_ACCESSORY_DISPATCH)
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
from tests.common import async_fire_time_changed, fire_service_discovered
|
||||
from tests.common import (
|
||||
async_fire_time_changed, fire_service_discovered, load_fixture)
|
||||
|
||||
|
||||
class FakePairing:
|
||||
@@ -149,10 +151,13 @@ class FakeService(AbstractService):
|
||||
return char
|
||||
|
||||
|
||||
def setup_accessories_from_file(path):
|
||||
async def setup_accessories_from_file(hass, path):
|
||||
"""Load an collection of accessory defs from JSON data."""
|
||||
with open(path, 'r') as accessories_data:
|
||||
accessories_json = json.load(accessories_data)
|
||||
accessories_fixture = await hass.async_add_executor_job(
|
||||
load_fixture,
|
||||
os.path.join('homekit_controller', path),
|
||||
)
|
||||
accessories_json = json.loads(accessories_fixture)
|
||||
|
||||
accessories = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user