71803418e5
Shelly device management app with mDNS/subnet discovery, inventory, configuration, and mass operations for Gen1/Gen2+ devices. Includes .gitignore excluding runtime data (device DB, user config), AI conversation history, build artifacts, and common Python/OS patterns.
32 lines
954 B
Python
32 lines
954 B
Python
"""Gen2 config RPC mapping (no device)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from shelly_manager.api.gen2_config_rpc import (
|
|
iter_changed_top_level_keys,
|
|
set_config_method_and_params,
|
|
)
|
|
|
|
|
|
def test_set_config_switch_indexed() -> None:
|
|
m, p = set_config_method_and_params("switch:0", {"name": "R1"})
|
|
assert m == "Switch.SetConfig"
|
|
assert p == {"id": 0, "config": {"name": "R1"}}
|
|
|
|
|
|
def test_set_config_sys_singleton() -> None:
|
|
m, p = set_config_method_and_params("sys", {"device": {"name": "x"}})
|
|
assert m == "Sys.SetConfig"
|
|
assert p == {"config": {"device": {"name": "x"}}}
|
|
|
|
|
|
def test_set_config_wifi() -> None:
|
|
m, p = set_config_method_and_params("wifi", {"sta": {"ssid": "a"}})
|
|
assert m == "WiFi.SetConfig"
|
|
|
|
|
|
def test_iter_changed_top_level_keys() -> None:
|
|
old = {"sys": {"a": 1}, "wifi": {"x": 1}}
|
|
new = {"sys": {"a": 1}, "wifi": {"x": 2}}
|
|
assert iter_changed_top_level_keys(old, new) == ["wifi"]
|