Files
python-kasa/tests/iot/test_iotstrip.py
ZeliardM 29007e1079
Some checks failed
CI / Perform linting checks (3.13) (push) Has been cancelled
CodeQL checks / Analyze (python) (push) Has been cancelled
CI / Python 3.11 on macos-latest (push) Has been cancelled
CI / Python 3.12 on macos-latest (push) Has been cancelled
CI / Python 3.13 on macos-latest (push) Has been cancelled
CI / Python 3.11 on ubuntu-latest (push) Has been cancelled
CI / Python 3.12 on ubuntu-latest (push) Has been cancelled
CI / Python 3.13 on ubuntu-latest (push) Has been cancelled
CI / Python 3.11 on windows-latest (push) Has been cancelled
CI / Python 3.12 on windows-latest (push) Has been cancelled
CI / Python 3.13 on windows-latest (push) Has been cancelled
Stale / stale (push) Has been cancelled
Fix iotstrip child device time handling (#1584)
This fixes the time handling of the child devices for iotstrip to
pull from the parent device time module instead of having each child
with its own time module.
2025-10-31 21:32:13 +01:00

45 lines
1.1 KiB
Python

from unittest.mock import AsyncMock
from kasa import Module
from tests.conftest import strip_emeter_iot, strip_iot
@strip_iot
async def test_strip_update_and_child_update_behaviors(dev):
await dev.update()
await dev.update(update_children=False)
assert dev.children, "Expected strip device to have children"
child = dev.children[0]
await child.update(update_children=False)
assert getattr(child, "_features", None)
@strip_iot
async def test_strip_child_delegated_properties(dev):
await dev.update()
child = dev.children[0]
assert child.led is False
assert child.time == dev.time
assert child.timezone == dev.timezone
na = child.next_action
assert isinstance(na, dict)
assert "type" in na
@strip_emeter_iot
async def test_strip_emeter_erase_stats(dev, mocker):
await dev.update()
for child in dev.children:
energy = child.modules.get(Module.Energy)
if energy:
mocker.patch.object(energy, "erase_stats", AsyncMock(return_value={}))
res = await dev.modules[Module.Energy].erase_stats()
assert res == {}