2022-03-21 21:10:12 +00:00
|
|
|
import pytest
|
|
|
|
|
2021-09-24 20:26:21 +00:00
|
|
|
from kasa import DeviceType, SmartLightStrip
|
2022-03-21 21:10:12 +00:00
|
|
|
from kasa.exceptions import SmartDeviceException
|
2021-09-24 20:26:21 +00:00
|
|
|
|
|
|
|
from .conftest import lightstrip, pytestmark
|
|
|
|
|
|
|
|
|
|
|
|
@lightstrip
|
|
|
|
async def test_lightstrip_length(dev: SmartLightStrip):
|
|
|
|
assert dev.is_light_strip
|
|
|
|
assert dev.device_type == DeviceType.LightStrip
|
|
|
|
assert dev.length == dev.sys_info["length"]
|
|
|
|
|
|
|
|
|
|
|
|
@lightstrip
|
|
|
|
async def test_lightstrip_effect(dev: SmartLightStrip):
|
|
|
|
assert isinstance(dev.effect, dict)
|
|
|
|
for k in ["brightness", "custom", "enable", "id", "name"]:
|
|
|
|
assert k in dev.effect
|
2022-03-21 21:10:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
@lightstrip
|
|
|
|
async def test_effects_lightstrip_set_effect(dev: SmartLightStrip):
|
|
|
|
with pytest.raises(SmartDeviceException):
|
|
|
|
await dev.set_effect("Not real")
|
|
|
|
|
|
|
|
await dev.set_effect("Candy Cane")
|
|
|
|
assert dev.effect["name"] == "Candy Cane"
|
|
|
|
assert dev.state_information["Effect"] == "Candy Cane"
|
|
|
|
|
|
|
|
|
|
|
|
@lightstrip
|
|
|
|
async def test_effects_lightstrip_has_effects(dev: SmartLightStrip):
|
|
|
|
assert dev.has_effects is True
|
|
|
|
assert dev.effect_list
|