Migrate RuleModule to mashumaro (#1283)

Also fixes a bug whereby multiple queries for the same module would overwrite each other.
This commit is contained in:
Steven B.
2024-11-20 14:59:32 +00:00
committed by GitHub
parent a4258cc75b
commit f7778aaa53
4 changed files with 70 additions and 13 deletions

View File

@@ -0,0 +1,17 @@
import pytest
from kasa import Device, Module
from kasa.iot.modules.rulemodule import Action, TimeOption
from ...device_fixtures import device_iot
@device_iot
def test_schedule(dev: Device, caplog: pytest.LogCaptureFixture):
schedule = dev.modules.get(Module.IotSchedule)
assert schedule
if rules := schedule.rules:
first = rules[0]
assert isinstance(first.sact, Action)
assert isinstance(first.stime_opt, TimeOption)
assert "Unable to read rule list" not in caplog.text