Reolink fix not unregistering webhook during ReAuth (#117490)
This commit is contained in:
parent
6c892b227b
commit
e286621f93
2 changed files with 7 additions and 1 deletions
|
@ -85,6 +85,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
||||||
try:
|
try:
|
||||||
await host.update_states()
|
await host.update_states()
|
||||||
except CredentialsInvalidError as err:
|
except CredentialsInvalidError as err:
|
||||||
|
await host.stop()
|
||||||
raise ConfigEntryAuthFailed(err) from err
|
raise ConfigEntryAuthFailed(err) from err
|
||||||
except ReolinkError as err:
|
except ReolinkError as err:
|
||||||
raise UpdateFailed(str(err)) from err
|
raise UpdateFailed(str(err)) from err
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any
|
||||||
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from reolink_aio.exceptions import ReolinkError
|
from reolink_aio.exceptions import CredentialsInvalidError, ReolinkError
|
||||||
|
|
||||||
from homeassistant.components.reolink import FIRMWARE_UPDATE_INTERVAL, const
|
from homeassistant.components.reolink import FIRMWARE_UPDATE_INTERVAL, const
|
||||||
from homeassistant.config import async_process_ha_core_config
|
from homeassistant.config import async_process_ha_core_config
|
||||||
|
@ -50,6 +50,11 @@ pytestmark = pytest.mark.usefixtures("reolink_connect", "reolink_platforms")
|
||||||
AsyncMock(side_effect=ReolinkError("Test error")),
|
AsyncMock(side_effect=ReolinkError("Test error")),
|
||||||
ConfigEntryState.SETUP_RETRY,
|
ConfigEntryState.SETUP_RETRY,
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"get_states",
|
||||||
|
AsyncMock(side_effect=CredentialsInvalidError("Test error")),
|
||||||
|
ConfigEntryState.SETUP_ERROR,
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"supported",
|
"supported",
|
||||||
Mock(return_value=False),
|
Mock(return_value=False),
|
||||||
|
|
Loading…
Add table
Reference in a new issue