Add silabs_multiprotocol platform (#92904)

* Add silabs_multiprotocol platform

* Add new files

* Add ZHA tests

* Prevent ZHA from creating database during tests

* Add delay parameter to async_change_channel

* Add the updated dataset to the dataset store

* Allow MultipanProtocol.async_change_channel to return a task

* Notify user about the duration of migration

* Update tests
This commit is contained in:
Erik Montnemery
2023-06-01 12:32:14 +02:00
committed by GitHub
parent 4f153a8f90
commit 15e5cf01bb
19 changed files with 1072 additions and 148 deletions

View File

@@ -1,5 +1,5 @@
"""Test OTBR Websocket API."""
from unittest.mock import Mock, patch
from unittest.mock import patch
import pytest
import python_otbr_api
@@ -273,6 +273,7 @@ async def test_set_network_no_entry(
async def test_set_network_channel_conflict(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
multiprotocol_addon_manager_mock,
otbr_config_entry,
websocket_client,
) -> None:
@@ -281,24 +282,16 @@ async def test_set_network_channel_conflict(
dataset_store = await thread.dataset_store.async_get_store(hass)
dataset_id = list(dataset_store.datasets)[0]
networksettings = Mock()
networksettings.network_info.channel = 15
multiprotocol_addon_manager_mock.async_get_channel.return_value = 15
with patch(
"homeassistant.components.otbr.util.zha_api.async_get_radio_path",
return_value="socket://core-silabs-multiprotocol:9999",
), patch(
"homeassistant.components.otbr.util.zha_api.async_get_network_settings",
return_value=networksettings,
):
await websocket_client.send_json_auto_id(
{
"type": "otbr/set_network",
"dataset_id": dataset_id,
}
)
await websocket_client.send_json_auto_id(
{
"type": "otbr/set_network",
"dataset_id": dataset_id,
}
)
msg = await websocket_client.receive_json()
msg = await websocket_client.receive_json()
assert not msg["success"]
assert msg["error"]["code"] == "channel_conflict"