| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5aa40ed commit 2c10b1e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,7 @@ class SmartCamModule(SmartModule): | |||
| 58 | 58 | "devicemodule" | |
| 59 | 59 | ) | |
| 60 | 60 | ||
| 61 | - SmartCamWhiteLamp: Final[ModuleName[modules.WhiteLamp]] = ModuleName("whiteLamp") | ||
| 61 | + SmartCamWhiteLamp: Final[ModuleName[modules.WhiteLamp]] = ModuleName("WhiteLamp") | ||
| 62 | 62 | ||
| 63 | 63 | #: Module name to be queried | |
| 64 | 64 | QUERY_MODULE_NAME: str | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | import pytest | |
| 6 | 6 | ||
| 7 | 7 | from kasa import Device, Module | |
| 8 | + from kasa.smartcam.smartcammodule import SmartCamModule | ||
| 8 | 9 | ||
| 9 | 10 | from ...device_fixtures import parametrize | |
| 10 | 11 | ||
@@ -18,6 +19,7 @@ async def test_whitelamp_is_on(dev: Device): | |||
| 18 | 19 | """Test white lamp on/off state reflects fixture data.""" | |
| 19 | 20 | whitelamp = dev.modules.get(Module.WhiteLamp) | |
| 20 | 21 | assert whitelamp is not None | |
| 22 | + assert dev.modules.get(SmartCamModule.SmartCamWhiteLamp) is whitelamp | ||
| 21 | 23 | ||
| 22 | 24 | assert isinstance(whitelamp.is_on, bool) | |
| 23 | 25 | ||
@@ -83,6 +85,20 @@ async def test_whitelamp_brightness(dev: Device): | |||
| 83 | 85 | await dev.update() | |
| 84 | 86 | ||
| 85 | 87 | ||
| 88 | + @whitelamp_smartcam | ||
| 89 | + async def test_whitelamp_no_brightness(dev: Device): | ||
| 90 | + """Test that brightness feature is absent when device does not support it.""" | ||
| 91 | + whitelamp = dev.modules.get(Module.WhiteLamp) | ||
| 92 | + assert whitelamp is not None | ||
| 93 | + | ||
| 94 | + config = whitelamp.data["getWhitelampConfig"]["image"]["switch"] | ||
| 95 | + if "wtl_intensity_level" not in config: | ||
| 96 | + assert not whitelamp.has_feature("brightness") | ||
| 97 | + assert "white_lamp_brightness" not in dev.features | ||
| 98 | + else: | ||
| 99 | + pytest.skip("Device supports brightness, skipping no-brightness test") | ||
| 100 | + | ||
| 101 | + | ||
| 86 | 102 | @whitelamp_smartcam | |
| 87 | 103 | async def test_whitelamp_features(dev: Device): | |
| 88 | 104 | """Test white lamp features are registered on the device.""" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments