Huawei LTE misc improvements (#26203)
* Constant and whitespace cleanups * Upgrade huawei_lte_api to 1.3.0 https://github.com/Salamek/huawei-lte-api/releases * Hush traceback if device does not support logout
This commit is contained in:
1 parent
bde572c91a
commit
0c49c82015
9 files changed
+80
-46
No files matched your search
@@ -4,6 +4,7 @@ from unittest.mock import Mock
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import huawei_lte
|
||||
from homeassistant.components.huawei_lte.const import KEY_DEVICE_INFORMATION
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -23,25 +24,25 @@ async def test_routerdata_get_nonexistent_root(routerdata):
|
||||
async def test_routerdata_get_nonexistent_leaf(routerdata):
|
||||
"""Test that accessing a nonexistent leaf element raises KeyError."""
|
||||
with pytest.raises(KeyError):
|
||||
routerdata["device_information.foo"]
|
||||
routerdata[f"{KEY_DEVICE_INFORMATION}.foo"]
|
||||
|
||||
|
||||
async def test_routerdata_get_nonexistent_leaf_path(routerdata):
|
||||
"""Test that accessing a nonexistent long path raises KeyError."""
|
||||
with pytest.raises(KeyError):
|
||||
routerdata["device_information.long.path.foo"]
|
||||
routerdata[f"{KEY_DEVICE_INFORMATION}.long.path.foo"]
|
||||
|
||||
|
||||
async def test_routerdata_get_simple(routerdata):
|
||||
"""Test that accessing a short, simple path works."""
|
||||
assert routerdata["device_information.SoftwareVersion"] == "1.0"
|
||||
assert routerdata[f"{KEY_DEVICE_INFORMATION}.SoftwareVersion"] == "1.0"
|
||||
|
||||
|
||||
async def test_routerdata_get_longer(routerdata):
|
||||
"""Test that accessing a longer path works."""
|
||||
assert routerdata["device_information.nested.foo"] == "bar"
|
||||
assert routerdata[f"{KEY_DEVICE_INFORMATION}.nested.foo"] == "bar"
|
||||
|
||||
|
||||
async def test_routerdata_get_dict(routerdata):
|
||||
"""Test that returning an intermediate dict works."""
|
||||
assert routerdata["device_information.nested"] == {"foo": "bar"}
|
||||
assert routerdata[f"{KEY_DEVICE_INFORMATION}.nested"] == {"foo": "bar"}
|
||||
Reference in new issue
Block a user