From 759eb092d5caa8f1f30f32528ca1cbbce001353f Mon Sep 17 00:00:00 2001 From: Steven B <51370195+sdb9696@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:55:21 +0000 Subject: [PATCH] Fix tests --- tests/fakeprotocol_iot.py | 4 ---- tests/iot/test_iotdevice.py | 3 ++- tests/test_feature.py | 6 +++++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/fakeprotocol_iot.py b/tests/fakeprotocol_iot.py index 88e34647..23ce7827 100644 --- a/tests/fakeprotocol_iot.py +++ b/tests/fakeprotocol_iot.py @@ -308,10 +308,6 @@ class FakeIotTransport(BaseTransport): child_ids = [] _LOGGER.debug("Setting relay state to %s", x["state"]) - if not child_ids and "children" in self.proto["system"]["get_sysinfo"]: - for child in self.proto["system"]["get_sysinfo"]["children"]: - child_ids.append(child["id"]) - _LOGGER.info("child_ids: %s", child_ids) if child_ids: for child in self.proto["system"]["get_sysinfo"]["children"]: diff --git a/tests/iot/test_iotdevice.py b/tests/iot/test_iotdevice.py index 858c5fbc..0b822859 100644 --- a/tests/iot/test_iotdevice.py +++ b/tests/iot/test_iotdevice.py @@ -137,8 +137,9 @@ async def test_query_helper(dev): @device_iot @turn_on async def test_state(dev, turn_on): - await handle_turn_on(dev, turn_on) orig_state = dev.is_on + await handle_turn_on(dev, turn_on) + await dev.update() if orig_state: await dev.turn_off() await dev.update() diff --git a/tests/test_feature.py b/tests/test_feature.py index 46cdd116..ea5c05c1 100644 --- a/tests/test_feature.py +++ b/tests/test_feature.py @@ -5,6 +5,7 @@ import pytest from pytest_mock import MockerFixture from kasa import Device, Feature, KasaException +from kasa.iot import IotStrip _LOGGER = logging.getLogger(__name__) @@ -168,7 +169,10 @@ async def test_feature_setters(dev: Device, mocker: MockerFixture): if feat.attribute_setter is None: return - expecting_call = feat.id not in internal_setters + # IotStrip makes calls via it's children + expecting_call = feat.id not in internal_setters and not isinstance( + dev, IotStrip + ) if feat.type == Feature.Type.Number: await feat.set_value(feat.minimum_value)