init home-assistant
This commit is contained in:
38
home-assistant/tests/components/wmspro/test_init.py
Normal file
38
home-assistant/tests/components/wmspro/test_init.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user