ZHA code cleanup. (#25644)
* isort ZHA imports. * Sort zha channel registry. * Sort ZHA core registry. * Sort ZHA core consts.
This commit is contained in:
1 parent
39257164a9
commit
77e4ff94fd
26 files changed
+627
-563
No files matched your search
@@ -1,15 +1,15 @@
|
||||
"""Test ZHA API."""
|
||||
import pytest
|
||||
from homeassistant.components.switch import DOMAIN
|
||||
from homeassistant.components.zha.api import async_load_api, ATTR_IEEE, TYPE, ID
|
||||
from homeassistant.components.zha.api import async_load_api, TYPE, ID
|
||||
from homeassistant.components.zha.core.const import (
|
||||
ATTR_CLUSTER_ID,
|
||||
ATTR_CLUSTER_TYPE,
|
||||
IN,
|
||||
IEEE,
|
||||
MODEL,
|
||||
NAME,
|
||||
QUIRK_APPLIED,
|
||||
CLUSTER_TYPE_IN,
|
||||
ATTR_IEEE,
|
||||
ATTR_MODEL,
|
||||
ATTR_NAME,
|
||||
ATTR_QUIRK_APPLIED,
|
||||
ATTR_MANUFACTURER,
|
||||
ATTR_ENDPOINT_ID,
|
||||
)
|
||||
@@ -49,14 +49,14 @@ async def test_device_clusters(hass, config_entry, zha_gateway, zha_client):
|
||||
cluster_infos = sorted(msg["result"], key=lambda k: k[ID])
|
||||
|
||||
cluster_info = cluster_infos[0]
|
||||
assert cluster_info[TYPE] == IN
|
||||
assert cluster_info[TYPE] == CLUSTER_TYPE_IN
|
||||
assert cluster_info[ID] == 0
|
||||
assert cluster_info[NAME] == "Basic"
|
||||
assert cluster_info[ATTR_NAME] == "Basic"
|
||||
|
||||
cluster_info = cluster_infos[1]
|
||||
assert cluster_info[TYPE] == IN
|
||||
assert cluster_info[TYPE] == CLUSTER_TYPE_IN
|
||||
assert cluster_info[ID] == 6
|
||||
assert cluster_info[NAME] == "OnOff"
|
||||
assert cluster_info[ATTR_NAME] == "OnOff"
|
||||
|
||||
|
||||
async def test_device_cluster_attributes(hass, config_entry, zha_gateway, zha_client):
|
||||
@@ -68,7 +68,7 @@ async def test_device_cluster_attributes(hass, config_entry, zha_gateway, zha_cl
|
||||
ATTR_ENDPOINT_ID: 1,
|
||||
ATTR_IEEE: "00:0d:6f:00:0a:90:69:e7",
|
||||
ATTR_CLUSTER_ID: 6,
|
||||
ATTR_CLUSTER_TYPE: IN,
|
||||
ATTR_CLUSTER_TYPE: CLUSTER_TYPE_IN,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -79,7 +79,7 @@ async def test_device_cluster_attributes(hass, config_entry, zha_gateway, zha_cl
|
||||
|
||||
for attribute in attributes:
|
||||
assert attribute[ID] is not None
|
||||
assert attribute[NAME] is not None
|
||||
assert attribute[ATTR_NAME] is not None
|
||||
|
||||
|
||||
async def test_device_cluster_commands(hass, config_entry, zha_gateway, zha_client):
|
||||
@@ -91,7 +91,7 @@ async def test_device_cluster_commands(hass, config_entry, zha_gateway, zha_clie
|
||||
ATTR_ENDPOINT_ID: 1,
|
||||
ATTR_IEEE: "00:0d:6f:00:0a:90:69:e7",
|
||||
ATTR_CLUSTER_ID: 6,
|
||||
ATTR_CLUSTER_TYPE: IN,
|
||||
ATTR_CLUSTER_TYPE: CLUSTER_TYPE_IN,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -102,7 +102,7 @@ async def test_device_cluster_commands(hass, config_entry, zha_gateway, zha_clie
|
||||
|
||||
for command in commands:
|
||||
assert command[ID] is not None
|
||||
assert command[NAME] is not None
|
||||
assert command[ATTR_NAME] is not None
|
||||
assert command[TYPE] is not None
|
||||
|
||||
|
||||
@@ -116,13 +116,13 @@ async def test_list_devices(hass, config_entry, zha_gateway, zha_client):
|
||||
assert len(devices) == 1
|
||||
|
||||
for device in devices:
|
||||
assert device[IEEE] is not None
|
||||
assert device[ATTR_IEEE] is not None
|
||||
assert device[ATTR_MANUFACTURER] is not None
|
||||
assert device[MODEL] is not None
|
||||
assert device[NAME] is not None
|
||||
assert device[QUIRK_APPLIED] is not None
|
||||
assert device[ATTR_MODEL] is not None
|
||||
assert device[ATTR_NAME] is not None
|
||||
assert device[ATTR_QUIRK_APPLIED] is not None
|
||||
assert device["entities"] is not None
|
||||
|
||||
for entity_reference in device["entities"]:
|
||||
assert entity_reference[NAME] is not None
|
||||
assert entity_reference[ATTR_NAME] is not None
|
||||
assert entity_reference["entity_id"] is not None
|
||||
Reference in new issue
Block a user