Skip to content

Commit

Permalink
Add coverage for 1.10 firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Mar 14, 2022
1 parent 5164976 commit e8c5e9f
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pywizlight/tests/fake_bulb.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,21 @@
"drvConf": [20, 1],
},
},
("ESP05_SHTW_21", "1.10.0"): {
"method": "getSystemConfig",
"env": "pro",
"result": {
"mac": "a8bb5007bfc6",
"homeId": 5385975,
"homeLock": False,
"pairingLock": False,
"typeId": 0,
"moduleName": "ESP05_SHTW_21",
"fwVersion": "1.10.0",
"groupId": 0,
"drvConf": [20, 1],
},
},
("ESP06_SHDW9_01", "1.11.7"): {
"method": "getSystemConfig",
"env": "",
Expand Down Expand Up @@ -519,6 +534,19 @@
"po": False,
},
},
("ESP05_SHTW_21", "1.10.0"): {
"method": "getUserConfig",
"env": "pro",
"result": {
"fadeIn": 450,
"fadeOut": 500,
"fadeNight": False,
"dftDim": 100,
"pwmRange": [0, 100],
"whiteRange": [2700, 6500],
"extRange": [2700, 6500],
},
},
("ESP14_SHTW1C_01", "1.18.0"): {
"method": "getUserConfig",
"env": "pro",
Expand Down
36 changes: 36 additions & 0 deletions pywizlight/tests/test_bulb_turnable_white_1_10_0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Tests for the Bulb API with a turnable white device with 1.10.0 firmware."""
from typing import AsyncGenerator

import pytest

from pywizlight import wizlight
from pywizlight.bulblibrary import BulbClass, BulbType, Features, KelvinRange
from pywizlight.tests.fake_bulb import startup_bulb


@pytest.fixture()
async def turnable_bulb() -> AsyncGenerator[wizlight, None]:
shutdown, port = await startup_bulb(
module_name="ESP05_SHTW_21", firmware_version="1.10.0"
)
bulb = wizlight(ip="127.0.0.1", port=port)
yield bulb
await bulb.async_close()
shutdown()


@pytest.mark.asyncio
async def test_model_description_dimmable_bulb(turnable_bulb: wizlight) -> None:
"""Test fetching the model description dimmable bulb."""
bulb_type = await turnable_bulb.get_bulbtype()
assert bulb_type == BulbType(
features=Features(
color=False, color_tmp=True, effect=True, brightness=True, dual_head=False
),
name="ESP05_SHTW_21",
kelvin_range=KelvinRange(max=6500, min=2700),
bulb_type=BulbClass.TW,
fw_version="1.10.0",
white_channels=1,
white_to_color_ratio=20,
)

0 comments on commit e8c5e9f

Please sign in to comment.