Don't crash on devices not reporting features (#317)

Returns an empty set if no feature information is available
This commit is contained in:
Teemu R
2022-03-02 16:29:20 +01:00
committed by GitHub
parent e3d76bea75
commit b22f6b4eef
2 changed files with 14 additions and 1 deletions

View File

@@ -139,3 +139,12 @@ async def test_childrens(dev):
async def test_internal_state(dev):
"""Make sure the internal state returns the last update results."""
assert dev.internal_state == dev._last_update
async def test_features(dev):
"""Make sure features is always accessible."""
sysinfo = dev._last_update["system"]["get_sysinfo"]
if "feature" in sysinfo:
assert dev.features == set(sysinfo["feature"].split(":"))
else:
assert dev.features == set()