mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-16 13:08:28 +00:00
Improve testing harness to allow tests on real devices (#197)
* test_cli: provide return values to patched objects to avoid warning about non-awaited calls
* test_cli: restore alias after testing
* smartstrip: remove internal update() calls for turn_{on,off}, set_led
* Make sure power is always a float
* Fix discovery tests
* Make tests runnable on real devices
* Add a note about running tests on a real device
* test_strip: run update against the parent device
This commit is contained in:
@@ -15,20 +15,24 @@ async def test_children_change_state(dev, turn_on):
|
||||
orig_state = plug.is_on
|
||||
if orig_state:
|
||||
await plug.turn_off()
|
||||
assert not plug.is_on
|
||||
assert plug.is_off
|
||||
await dev.update()
|
||||
assert plug.is_on is False
|
||||
assert plug.is_off is True
|
||||
|
||||
await plug.turn_on()
|
||||
assert plug.is_on
|
||||
assert not plug.is_off
|
||||
await dev.update()
|
||||
assert plug.is_on is True
|
||||
assert plug.is_off is False
|
||||
else:
|
||||
await plug.turn_on()
|
||||
assert plug.is_on
|
||||
assert not plug.is_off
|
||||
await dev.update()
|
||||
assert plug.is_on is True
|
||||
assert plug.is_off is False
|
||||
|
||||
await plug.turn_off()
|
||||
assert not plug.is_on
|
||||
assert plug.is_off
|
||||
await dev.update()
|
||||
assert plug.is_on is False
|
||||
assert plug.is_off is True
|
||||
|
||||
|
||||
@strip
|
||||
|
||||
Reference in New Issue
Block a user