Update ZHA entity discovery tests (#31191)

* ZHA registry test fixtures refactoring.

* Update ZHA test devices list.

* Use channel.id for event relay channels test.

* Add zigpy_device factory fixture.

* Add node descriptor to mock zigpy devices.

* Use node descriptor for ZHA device tests.

* Update ZHA discovery test.

check for unique_id and channels passed into each entity.

* Address comments.
This commit is contained in:
Alexei Chetroi authored and David F. Mulcahey committed 2020-01-27 19:43:26 -05:00
1 parent 6daec557b4
commit 9d8b4de09c
6 files changed
+2012 -259

No files matched your search

+8 -6
View File
@@ -6,8 +6,6 @@ import homeassistant.components.zha.core.channels as channels
import homeassistant.components.zha.core.device as zha_device
import homeassistant.components.zha.core.registries as registries
from .common import make_device
@pytest.fixture
def ieee():
@@ -64,9 +62,11 @@ def nwk():
(0x1000, 1, {}),
],
)
async def test_in_channel_config(cluster_id, bind_count, attrs, zha_gateway, hass):
async def test_in_channel_config(
cluster_id, bind_count, attrs, zha_gateway, hass, zigpy_device_mock
):
"""Test ZHA core channel configuration for input clusters."""
zigpy_dev = make_device(
zigpy_dev = zigpy_device_mock(
{1: {"in_clusters": [cluster_id], "out_clusters": [], "device_type": 0x1234}},
"00:11:22:33:44:55:66:77",
"test manufacturer",
@@ -120,9 +120,11 @@ async def test_in_channel_config(cluster_id, bind_count, attrs, zha_gateway, has
(0x1000, 1),
],
)
async def test_out_channel_config(cluster_id, bind_count, zha_gateway, hass):
async def test_out_channel_config(
cluster_id, bind_count, zha_gateway, hass, zigpy_device_mock
):
"""Test ZHA core channel configuration for output clusters."""
zigpy_dev = make_device(
zigpy_dev = zigpy_device_mock(
{1: {"out_clusters": [cluster_id], "in_clusters": [], "device_type": 0x1234}},
"00:11:22:33:44:55:66:77",
"test manufacturer",