Skip to content

Commit 60ec70a

Browse files
Fix node update endpoints (#1264)
* Add test * Fix node update endpoints
1 parent e02069f commit 60ec70a

File tree

5 files changed

+2117
-3
lines changed

5 files changed

+2117
-3
lines changed

test/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
import pathlib
44

55

6-
def load_fixture(name):
6+
def load_fixture(name: str) -> str:
77
"""Load a fixture."""
88
return (pathlib.Path(__file__).parent / "fixtures" / name).read_text()

test/conftest.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from zwave_js_server.client import Client
1616
from zwave_js_server.model.controller import Controller
1717
from zwave_js_server.model.driver import Driver
18-
from zwave_js_server.model.node import Node
18+
from zwave_js_server.model.node import Node, NodeDataType
1919

2020
from . import load_fixture
2121
from .common import MockCommandProtocol
@@ -103,6 +103,22 @@ def ring_keypad_state_fixture():
103103
return json.loads(load_fixture("ring_keypad_state.json"))
104104

105105

106+
@pytest.fixture(name="shelly_wave_shutter_state", scope="session")
107+
def shelly_wave_shutter_state_fixture() -> NodeDataType:
108+
"""Load the shelly wave shutter node state fixture data."""
109+
return json.loads(load_fixture("shelly_eu_wave_shutter_state.json"))
110+
111+
112+
@pytest.fixture(name="shelly_wave_shutter")
113+
def shelly_wave_shutter_fixture(
114+
driver: Driver, shelly_wave_shutter_state: NodeDataType
115+
) -> Node:
116+
"""Mock a shelly wave shutter node."""
117+
node = Node(driver.client, deepcopy(shelly_wave_shutter_state))
118+
driver.controller.nodes[node.node_id] = node
119+
return node
120+
121+
106122
@pytest.fixture(name="endpoints_with_command_classes_state", scope="session")
107123
def endpoints_with_command_classes_state_fixture():
108124
"""Load the node state fixture data with command classes on the endpoint."""

0 commit comments

Comments
 (0)