mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Fix tests
This commit is contained in:
parent
a99af97b65
commit
759eb092d5
@ -308,10 +308,6 @@ class FakeIotTransport(BaseTransport):
|
|||||||
child_ids = []
|
child_ids = []
|
||||||
_LOGGER.debug("Setting relay state to %s", x["state"])
|
_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)
|
_LOGGER.info("child_ids: %s", child_ids)
|
||||||
if child_ids:
|
if child_ids:
|
||||||
for child in self.proto["system"]["get_sysinfo"]["children"]:
|
for child in self.proto["system"]["get_sysinfo"]["children"]:
|
||||||
|
@ -137,8 +137,9 @@ async def test_query_helper(dev):
|
|||||||
@device_iot
|
@device_iot
|
||||||
@turn_on
|
@turn_on
|
||||||
async def test_state(dev, turn_on):
|
async def test_state(dev, turn_on):
|
||||||
await handle_turn_on(dev, turn_on)
|
|
||||||
orig_state = dev.is_on
|
orig_state = dev.is_on
|
||||||
|
await handle_turn_on(dev, turn_on)
|
||||||
|
await dev.update()
|
||||||
if orig_state:
|
if orig_state:
|
||||||
await dev.turn_off()
|
await dev.turn_off()
|
||||||
await dev.update()
|
await dev.update()
|
||||||
|
@ -5,6 +5,7 @@ import pytest
|
|||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
|
|
||||||
from kasa import Device, Feature, KasaException
|
from kasa import Device, Feature, KasaException
|
||||||
|
from kasa.iot import IotStrip
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -168,7 +169,10 @@ async def test_feature_setters(dev: Device, mocker: MockerFixture):
|
|||||||
if feat.attribute_setter is None:
|
if feat.attribute_setter is None:
|
||||||
return
|
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:
|
if feat.type == Feature.Type.Number:
|
||||||
await feat.set_value(feat.minimum_value)
|
await feat.set_value(feat.minimum_value)
|
||||||
|
Loading…
Reference in New Issue
Block a user