Fix Shelly white light test (#109855)
parent
2e194c4ec3
commit
aea81a180c
|
@ -65,6 +65,24 @@ def mock_light_set_state(
|
|||
}
|
||||
|
||||
|
||||
def mock_white_light_set_state(
|
||||
turn="on",
|
||||
temp=4050,
|
||||
gain=19,
|
||||
brightness=128,
|
||||
transition=0,
|
||||
):
|
||||
"""Mock white light block set_state."""
|
||||
return {
|
||||
"ison": turn == "on",
|
||||
"mode": "white",
|
||||
"gain": gain,
|
||||
"temp": temp,
|
||||
"brightness": brightness,
|
||||
"transition": transition,
|
||||
}
|
||||
|
||||
|
||||
MOCK_BLOCKS = [
|
||||
Mock(
|
||||
sensor_ids={
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Tests for Shelly light platform."""
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
from aioshelly.const import (
|
||||
MODEL_BULB,
|
||||
MODEL_BULB_RGBW,
|
||||
|
@ -35,6 +37,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import init_integration, mutate_rpc_device_status
|
||||
from .conftest import mock_white_light_set_state
|
||||
|
||||
RELAY_BLOCK_ID = 0
|
||||
LIGHT_BLOCK_ID = 2
|
||||
|
@ -227,6 +230,11 @@ async def test_block_device_white_bulb(
|
|||
monkeypatch.delattr(mock_block_device.blocks[LIGHT_BLOCK_ID], "mode")
|
||||
monkeypatch.delattr(mock_block_device.blocks[LIGHT_BLOCK_ID], "colorTemp")
|
||||
monkeypatch.delattr(mock_block_device.blocks[LIGHT_BLOCK_ID], "effect")
|
||||
monkeypatch.setattr(
|
||||
mock_block_device.blocks[LIGHT_BLOCK_ID],
|
||||
"set_state",
|
||||
AsyncMock(side_effect=mock_white_light_set_state),
|
||||
)
|
||||
await init_integration(hass, 1, model=MODEL_VINTAGE_V2)
|
||||
|
||||
# Test initial
|
||||
|
|
Loading…
Reference in New Issue