Migrate ZHA when enabling multi-PAN support on HA Yellow (#82213)
* Migrate ZHA when enabling multi-PAN support on HA Yellow * Refactor BaseZhaFlow.async_step_maybe_confirm_ezsp_restore * Change data passed to ZHA to initiate migration * Catch errors during ZHA migration * Fix ZhaMigrationHelper.async_prepare_yellow_migration return value * Improve test coverage * Improve test coverage * Fix spelling * Rename some none HA yellow specifics * Rename again * Increase number of migration retries + refactor * Suppress OperationNotAllowed when reloading * Adjust tests
This commit is contained in:
parent
15176300e2
commit
be7e76f302
16 changed files with 1120 additions and 117 deletions
|
@ -1,9 +1,37 @@
|
|||
"""Test fixtures for the Home Assistant Hardware integration."""
|
||||
from unittest.mock import patch
|
||||
from collections.abc import Generator
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_zha_config_flow_setup() -> Generator[None, None, None]:
|
||||
"""Mock the radio connection and probing of the ZHA config flow."""
|
||||
|
||||
def mock_probe(config: dict[str, Any]) -> None:
|
||||
# The radio probing will return the correct baudrate
|
||||
return {**config, "baudrate": 115200}
|
||||
|
||||
mock_connect_app = MagicMock()
|
||||
mock_connect_app.__aenter__.return_value.backups.backups = [MagicMock()]
|
||||
mock_connect_app.__aenter__.return_value.backups.create_backup.return_value = (
|
||||
MagicMock()
|
||||
)
|
||||
|
||||
with patch(
|
||||
"bellows.zigbee.application.ControllerApplication.probe", side_effect=mock_probe
|
||||
), patch(
|
||||
"homeassistant.components.zha.radio_manager.ZhaRadioManager._connect_zigpy_app",
|
||||
return_value=mock_connect_app,
|
||||
), patch(
|
||||
"homeassistant.components.zha.async_setup_entry",
|
||||
return_value=True,
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(name="addon_running")
|
||||
def mock_addon_running(addon_store_info, addon_info):
|
||||
"""Mock add-on already running."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue