Fix tests

This commit is contained in:
Steven B 2024-12-20 10:55:21 +00:00
parent a99af97b65
commit 759eb092d5
No known key found for this signature in database
GPG Key ID: 6D5B46B3679F2A43
3 changed files with 7 additions and 6 deletions

View File

@ -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"]:

View File

@ -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()

View File

@ -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)