mirror of
https://github.com/home-assistant/core.git
synced 2026-09-28 02:18:10 -04:00
Bump pypck to 0.8.1 (#133646)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
co-authored by
Robert Resch
parent
ad7a334147
commit
92195ff77d
@@ -2,7 +2,12 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from pypck.connection import PchkAuthenticationError, PchkLicenseError
|
||||
from pypck.connection import (
|
||||
PchkAuthenticationError,
|
||||
PchkConnectionFailedError,
|
||||
PchkConnectionRefusedError,
|
||||
PchkLicenseError,
|
||||
)
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
@@ -98,7 +103,8 @@ async def test_step_user_existing_host(
|
||||
[
|
||||
(PchkAuthenticationError, {CONF_BASE: "authentication_error"}),
|
||||
(PchkLicenseError, {CONF_BASE: "license_error"}),
|
||||
(TimeoutError, {CONF_BASE: "connection_refused"}),
|
||||
(PchkConnectionFailedError, {CONF_BASE: "connection_refused"}),
|
||||
(PchkConnectionRefusedError, {CONF_BASE: "connection_refused"}),
|
||||
],
|
||||
)
|
||||
async def test_step_user_error(
|
||||
@@ -149,7 +155,8 @@ async def test_step_reconfigure(hass: HomeAssistant, entry: MockConfigEntry) ->
|
||||
[
|
||||
(PchkAuthenticationError, {CONF_BASE: "authentication_error"}),
|
||||
(PchkLicenseError, {CONF_BASE: "license_error"}),
|
||||
(TimeoutError, {CONF_BASE: "connection_refused"}),
|
||||
(PchkConnectionFailedError, {CONF_BASE: "connection_refused"}),
|
||||
(PchkConnectionRefusedError, {CONF_BASE: "connection_refused"}),
|
||||
],
|
||||
)
|
||||
async def test_step_reconfigure_error(
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from pypck.connection import PchkAuthenticationError, PchkLicenseError
|
||||
from pypck.connection import (
|
||||
PchkAuthenticationError,
|
||||
PchkConnectionFailedError,
|
||||
PchkConnectionRefusedError,
|
||||
PchkLcnNotConnectedError,
|
||||
PchkLicenseError,
|
||||
)
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
@@ -84,21 +90,30 @@ async def test_async_setup_entry_update(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exception", [PchkAuthenticationError, PchkLicenseError, TimeoutError]
|
||||
"exception",
|
||||
[
|
||||
PchkAuthenticationError,
|
||||
PchkLicenseError,
|
||||
PchkConnectionRefusedError,
|
||||
PchkConnectionFailedError,
|
||||
PchkLcnNotConnectedError,
|
||||
],
|
||||
)
|
||||
async def test_async_setup_entry_raises_authentication_error(
|
||||
async def test_async_setup_entry_fails(
|
||||
hass: HomeAssistant, entry: MockConfigEntry, exception: Exception
|
||||
) -> None:
|
||||
"""Test that an authentication error is handled properly."""
|
||||
with patch(
|
||||
"homeassistant.components.lcn.PchkConnectionManager.async_connect",
|
||||
side_effect=exception,
|
||||
"""Test that an error is handled properly."""
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.lcn.PchkConnectionManager.async_connect",
|
||||
side_effect=exception,
|
||||
),
|
||||
):
|
||||
entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert entry.state is ConfigEntryState.SETUP_ERROR
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
@patch("homeassistant.components.lcn.PchkConnectionManager", MockPchkConnectionManager)
|
||||
|
||||
Reference in New Issue
Block a user