mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Correct logging and add test case for sharkiq (#41863)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
f499187835
commit
42cdbc7e1d
@ -74,7 +74,7 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
SharkIqNotAuthedError,
|
SharkIqNotAuthedError,
|
||||||
SharkIqAuthExpiringError,
|
SharkIqAuthExpiringError,
|
||||||
) as err:
|
) as err:
|
||||||
_LOGGER.exception("Bad auth state")
|
_LOGGER.debug("Bad auth state. Attempting re-auth", exc_info=err)
|
||||||
flow_context = {
|
flow_context = {
|
||||||
"source": "reauth",
|
"source": "reauth",
|
||||||
"unique_id": self._config_entry.unique_id,
|
"unique_id": self._config_entry.unique_id,
|
||||||
@ -87,6 +87,7 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
]
|
]
|
||||||
|
|
||||||
if not matching_flows:
|
if not matching_flows:
|
||||||
|
_LOGGER.debug("Re-initializing flows. Attempting re-auth")
|
||||||
self.hass.async_create_task(
|
self.hass.async_create_task(
|
||||||
self.hass.config_entries.flow.async_init(
|
self.hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
@ -94,6 +95,8 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
data=self._config_entry.data,
|
data=self._config_entry.data,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
_LOGGER.debug("Matching flow found")
|
||||||
|
|
||||||
raise UpdateFailed(err) from err
|
raise UpdateFailed(err) from err
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception as err: # pylint: disable=broad-except
|
||||||
|
@ -4,7 +4,7 @@ import enum
|
|||||||
from typing import Any, Iterable, List, Optional
|
from typing import Any, Iterable, List, Optional
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from sharkiqpy import AylaApi, SharkIqAuthError, SharkIqVacuum
|
from sharkiqpy import AylaApi, SharkIqAuthError, SharkIqNotAuthedError, SharkIqVacuum
|
||||||
|
|
||||||
from homeassistant.components.homeassistant import SERVICE_UPDATE_ENTITY
|
from homeassistant.components.homeassistant import SERVICE_UPDATE_ENTITY
|
||||||
from homeassistant.components.sharkiq import DOMAIN
|
from homeassistant.components.sharkiq import DOMAIN
|
||||||
@ -217,6 +217,7 @@ async def test_locate(hass):
|
|||||||
[
|
[
|
||||||
(None, True),
|
(None, True),
|
||||||
(SharkIqAuthError, False),
|
(SharkIqAuthError, False),
|
||||||
|
(SharkIqNotAuthedError, False),
|
||||||
(RuntimeError, False),
|
(RuntimeError, False),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user