mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Add toggle command to cli (#498)
This commit is contained in:
@@ -5,7 +5,7 @@ import pytest
|
||||
from asyncclick.testing import CliRunner
|
||||
|
||||
from kasa import SmartDevice
|
||||
from kasa.cli import alias, brightness, cli, emeter, raw_command, state, sysinfo
|
||||
from kasa.cli import alias, brightness, cli, emeter, raw_command, state, sysinfo, toggle
|
||||
|
||||
from .conftest import handle_turn_on, turn_on
|
||||
|
||||
@@ -30,6 +30,18 @@ async def test_state(dev, turn_on):
|
||||
assert "Device state: False" in res.output
|
||||
|
||||
|
||||
@turn_on
|
||||
async def test_toggle(dev, turn_on, mocker):
|
||||
await handle_turn_on(dev, turn_on)
|
||||
runner = CliRunner()
|
||||
await runner.invoke(toggle, obj=dev)
|
||||
|
||||
if turn_on:
|
||||
assert not dev.is_on
|
||||
else:
|
||||
assert dev.is_on
|
||||
|
||||
|
||||
async def test_alias(dev):
|
||||
runner = CliRunner()
|
||||
|
||||
|
Reference in New Issue
Block a user