Reolink fix not unregistering webhook during ReAuth (#117490)

This commit is contained in:
starkillerOG 2024-05-15 12:04:12 +02:00 committed by GitHub
parent 6c892b227b
commit e286621f93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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),