1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add tests for Shelly binary_sensor platform (#82367)

* Add tests for Shelly binary_sensor platform

* Rename create to register for
This commit is contained in:
Shay Levy
2022-11-19 18:07:02 +02:00
committed by GitHub
parent e028516939
commit ea98f0e9e8
6 changed files with 238 additions and 44 deletions

View File

@@ -63,9 +63,11 @@ def mock_light_set_state(
MOCK_BLOCKS = [
Mock(
sensor_ids={"inputEvent": "S", "inputEventCnt": 2},
sensor_ids={"inputEvent": "S", "inputEventCnt": 2, "overpower": 0},
channel="0",
type="relay",
overpower=0,
description="relay_0",
set_state=AsyncMock(side_effect=lambda turn: {"ison": turn == "on"}),
),
Mock(
@@ -88,6 +90,12 @@ MOCK_BLOCKS = [
type="light",
set_state=AsyncMock(side_effect=mock_light_set_state),
),
Mock(
sensor_ids={"motion": 0},
motion=0,
description="sensor_0",
type="sensor",
),
]
MOCK_CONFIG = {
@@ -135,7 +143,13 @@ MOCK_STATUS_COAP = {
MOCK_STATUS_RPC = {
"switch:0": {"output": True},
"cover:0": {"state": "stopped", "pos_control": True, "current_pos": 50},
"cloud": {"connected": False},
"cover:0": {
"state": "stopped",
"pos_control": True,
"current_pos": 50,
"apower": 85.3,
},
"sys": {
"available_updates": {
"beta": {"version": "some_beta_version"},