* Add new integration for WMS WebControl pro using local API Warema recently released a new local API for their WMS hub called "WebControl pro". This integration makes use of the new local API via a new dedicated Python library pywmspro. For now this integration only supports awnings as covers. But pywmspro is device-agnostic to ease future extensions. * Incorporated review feedback from joostlek Thanks a lot! * Incorporated more review feedback from joostlek Thanks a lot! * Incorporated more review feedback from joostlek Thanks a lot! * Fix * Follow-up fix * Improve handling of DHCP discovery * Further test improvements suggested by joostlek, thanks! --------- Co-authored-by: Joostlek <joostlek@outlook.com>
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""Test the wmspro initialization."""
|
|
|
|
from unittest.mock import AsyncMock
|
|
|
|
import aiohttp
|
|
|
|
from homeassistant.config_entries import ConfigEntryState
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from . import setup_config_entry
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
async def test_config_entry_device_config_ping_failed(
|
|
hass: HomeAssistant,
|
|
mock_config_entry: MockConfigEntry,
|
|
mock_hub_ping: AsyncMock,
|
|
) -> None:
|
|
"""Test that a config entry will be retried due to ConfigEntryNotReady."""
|
|
mock_hub_ping.side_effect = aiohttp.ClientError
|
|
await setup_config_entry(hass, mock_config_entry)
|
|
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
|
|
assert len(mock_hub_ping.mock_calls) == 1
|
|
|
|
|
|
async def test_config_entry_device_config_refresh_failed(
|
|
hass: HomeAssistant,
|
|
mock_config_entry: MockConfigEntry,
|
|
mock_hub_ping: AsyncMock,
|
|
mock_hub_refresh: AsyncMock,
|
|
) -> None:
|
|
"""Test that a config entry will be retried due to ConfigEntryNotReady."""
|
|
mock_hub_refresh.side_effect = aiohttp.ClientError
|
|
await setup_config_entry(hass, mock_config_entry)
|
|
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
|
|
assert len(mock_hub_ping.mock_calls) == 1
|
|
assert len(mock_hub_refresh.mock_calls) == 1
|