Add ability to reauth sonarr (#40306)
* add ability to reauth sonarr * Update config_flow.py * work on reauth * Update test_init.py * Update config_flow.py * Update strings.json * Update test_config_flow.py * Update strings.json * Update test_config_flow.py * Update __init__.py * Update __init__.py * Update config_flow.py * Update strings.json * Update config_flow.py * Update __init__.py * Update test_config_flow.py * Update test_config_flow.py * Update strings.json * Update test_config_flow.py * Update config_flow.py * Update test_config_flow.py * Update config_flow.py * Update strings.json * Update config_flow.py * Update test_config_flow.py * Update test_config_flow.py
This commit is contained in:
1 parent
bc89b63fc6
commit
432133a12a
6 files changed
+180
-27
No files matched your search
@@ -3,8 +3,11 @@ from homeassistant.components.sonarr.const import DOMAIN
|
||||
from homeassistant.config_entries import (
|
||||
ENTRY_STATE_LOADED,
|
||||
ENTRY_STATE_NOT_LOADED,
|
||||
ENTRY_STATE_SETUP_ERROR,
|
||||
ENTRY_STATE_SETUP_RETRY,
|
||||
SOURCE_REAUTH,
|
||||
)
|
||||
from homeassistant.const import CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.async_mock import patch
|
||||
@@ -20,6 +23,22 @@ async def test_config_entry_not_ready(
|
||||
assert entry.state == ENTRY_STATE_SETUP_RETRY
|
||||
|
||||
|
||||
async def test_config_entry_reauth(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test the configuration entry needing to be re-authenticated."""
|
||||
with patch.object(hass.config_entries.flow, "async_init") as mock_flow_init:
|
||||
entry = await setup_integration(hass, aioclient_mock, invalid_auth=True)
|
||||
|
||||
assert entry.state == ENTRY_STATE_SETUP_ERROR
|
||||
|
||||
mock_flow_init.assert_called_once_with(
|
||||
DOMAIN,
|
||||
context={CONF_SOURCE: SOURCE_REAUTH},
|
||||
data={"config_entry_id": entry.entry_id, **entry.data},
|
||||
)
|
||||
|
||||
|
||||
async def test_unload_config_entry(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
|
||||
Reference in new issue
Block a user