Add WS outbound config to Shelly diagnostics (#124654)
Add WS Outbound config to diagnostics
This commit is contained in:
parent
7334fb0125
commit
b960ebeb8b
2 changed files with 36 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
"""Tests for Shelly diagnostics platform."""
|
||||
|
||||
from copy import deepcopy
|
||||
from unittest.mock import ANY, Mock, PropertyMock
|
||||
|
||||
from aioshelly.ble.const import BLE_SCAN_RESULT_EVENT
|
||||
|
@ -151,7 +152,7 @@ async def test_rpc_config_entry_diagnostics(
|
|||
"model": MODEL_25,
|
||||
"sw_version": "some fw string",
|
||||
},
|
||||
"device_settings": {},
|
||||
"device_settings": {"ws_outbound_enabled": False},
|
||||
"device_status": {
|
||||
"sys": {
|
||||
"available_updates": {
|
||||
|
@ -164,3 +165,30 @@ async def test_rpc_config_entry_diagnostics(
|
|||
},
|
||||
"last_error": "DeviceConnectionError()",
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("ws_outbound_server", "ws_outbound_server_valid"),
|
||||
[("ws://10.10.10.10:8123/api/shelly/ws", True), ("wrong_url", False)],
|
||||
)
|
||||
async def test_rpc_config_entry_diagnostics_ws_outbound(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_rpc_device: Mock,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
ws_outbound_server: str,
|
||||
ws_outbound_server_valid: bool,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics for rpc device with websocket outbound."""
|
||||
config = deepcopy(mock_rpc_device.config)
|
||||
config["ws"] = {"enable": True, "server": ws_outbound_server}
|
||||
monkeypatch.setattr(mock_rpc_device, "config", config)
|
||||
|
||||
entry = await init_integration(hass, 2, sleep_period=60)
|
||||
|
||||
result = await get_diagnostics_for_config_entry(hass, hass_client, entry)
|
||||
|
||||
assert (
|
||||
result["device_settings"]["ws_outbound_server_valid"]
|
||||
== ws_outbound_server_valid
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue