mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Add --type option to cli (#269)
* Add support for controlling dimmers * Deprecate --bulb, --plug, --strip, --lightstrip
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
import pytest
|
||||
from asyncclick.testing import CliRunner
|
||||
|
||||
from kasa import SmartDevice
|
||||
from kasa.cli import alias, brightness, emeter, raw_command, state, sysinfo
|
||||
from kasa.cli import (
|
||||
TYPE_TO_CLASS,
|
||||
alias,
|
||||
brightness,
|
||||
cli,
|
||||
emeter,
|
||||
raw_command,
|
||||
state,
|
||||
sysinfo,
|
||||
)
|
||||
|
||||
from .conftest import handle_turn_on, pytestmark, turn_on
|
||||
|
||||
@@ -96,6 +106,21 @@ async def test_brightness(dev):
|
||||
assert "Brightness: 12" in res.output
|
||||
|
||||
|
||||
def _generate_type_class_pairs():
|
||||
yield from TYPE_TO_CLASS.items()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("type_class", _generate_type_class_pairs())
|
||||
async def test_deprecated_type(dev, type_class):
|
||||
"""Make sure that using deprecated types yields a warning."""
|
||||
type, cls = type_class
|
||||
if type == "dimmer":
|
||||
return
|
||||
runner = CliRunner()
|
||||
res = await runner.invoke(cli, ["--host", "127.0.0.2", f"--{type}"])
|
||||
assert "Using --bulb, --plug, --strip, and --lightstrip is deprecated" in res.output
|
||||
|
||||
|
||||
async def test_temperature(dev):
|
||||
pass
|
||||
|
||||
|
Reference in New Issue
Block a user