mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-14 06:08:53 +00:00
Fix iotstrip child device time handling (#1584)
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
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
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.
This commit is contained in:
44
tests/iot/test_iotstrip.py
Normal file
44
tests/iot/test_iotstrip.py
Normal file
@@ -0,0 +1,44 @@
|
||||
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 == {}
|
||||
Reference in New Issue
Block a user