mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Bump plugwise to v0.25.12 (#82146)
Co-authored-by: Franck Nijhof <frenck@frenck.nl> fixes undefined
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
"""Tests for the Plugwise Climate integration."""
|
||||
import asyncio
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import aiohttp
|
||||
from plugwise.exceptions import (
|
||||
ConnectionFailedError,
|
||||
PlugwiseException,
|
||||
XMLDataMissingError,
|
||||
InvalidAuthentication,
|
||||
InvalidXMLError,
|
||||
ResponseError,
|
||||
UnsupportedDeviceError,
|
||||
)
|
||||
import pytest
|
||||
|
||||
@@ -43,24 +43,52 @@ async def test_load_unload_config_entry(
|
||||
assert mock_config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect, entry_state",
|
||||
[
|
||||
(ConnectionFailedError, ConfigEntryState.SETUP_RETRY),
|
||||
(InvalidAuthentication, ConfigEntryState.SETUP_ERROR),
|
||||
(InvalidXMLError, ConfigEntryState.SETUP_RETRY),
|
||||
(ResponseError, ConfigEntryState.SETUP_RETRY),
|
||||
(UnsupportedDeviceError, ConfigEntryState.SETUP_ERROR),
|
||||
],
|
||||
)
|
||||
async def test_gateway_config_entry_not_ready(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_smile_anna: MagicMock,
|
||||
side_effect: Exception,
|
||||
entry_state: ConfigEntryState,
|
||||
) -> None:
|
||||
"""Test the Plugwise configuration entry not ready."""
|
||||
mock_smile_anna.connect.side_effect = side_effect
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert len(mock_smile_anna.connect.mock_calls) == 1
|
||||
assert mock_config_entry.state is entry_state
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"side_effect",
|
||||
[
|
||||
(ConnectionFailedError),
|
||||
(PlugwiseException),
|
||||
(XMLDataMissingError),
|
||||
(asyncio.TimeoutError),
|
||||
(aiohttp.ClientConnectionError),
|
||||
(InvalidAuthentication),
|
||||
(InvalidXMLError),
|
||||
(ResponseError),
|
||||
(UnsupportedDeviceError),
|
||||
],
|
||||
)
|
||||
async def test_config_entry_not_ready(
|
||||
async def test_coord_config_entry_not_ready(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_smile_anna: MagicMock,
|
||||
side_effect: Exception,
|
||||
) -> None:
|
||||
"""Test the Plugwise configuration entry not ready."""
|
||||
mock_smile_anna.connect.side_effect = side_effect
|
||||
mock_smile_anna.async_update.side_effect = side_effect
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
|
||||
Reference in New Issue
Block a user