Fix reauth step in nest (#74090)
This commit is contained in:
parent
319ef38d34
commit
35df012b6e
2 changed files with 2 additions and 19 deletions
|
@ -11,7 +11,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable, Mapping
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -218,14 +218,9 @@ class NestFlowHandler(
|
||||||
return await self.async_step_finish()
|
return await self.async_step_finish()
|
||||||
return await self.async_step_pubsub()
|
return await self.async_step_pubsub()
|
||||||
|
|
||||||
async def async_step_reauth(
|
async def async_step_reauth(self, user_input: Mapping[str, Any]) -> FlowResult:
|
||||||
self, user_input: dict[str, Any] | None = None
|
|
||||||
) -> FlowResult:
|
|
||||||
"""Perform reauth upon an API authentication error."""
|
"""Perform reauth upon an API authentication error."""
|
||||||
assert self.config_mode != ConfigMode.LEGACY, "Step only supported for SDM API"
|
assert self.config_mode != ConfigMode.LEGACY, "Step only supported for SDM API"
|
||||||
if user_input is None:
|
|
||||||
_LOGGER.error("Reauth invoked with empty config entry data")
|
|
||||||
return self.async_abort(reason="missing_configuration")
|
|
||||||
self._data.update(user_input)
|
self._data.update(user_input)
|
||||||
|
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
|
@ -505,18 +505,6 @@ async def test_reauth_multiple_config_entries(
|
||||||
assert entry.data.get("extra_data")
|
assert entry.data.get("extra_data")
|
||||||
|
|
||||||
|
|
||||||
async def test_reauth_missing_config_entry(hass, setup_platform):
|
|
||||||
"""Test the reauth flow invoked missing existing data."""
|
|
||||||
await setup_platform()
|
|
||||||
|
|
||||||
# Invoke the reauth flow with no existing data
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_REAUTH}, data=None
|
|
||||||
)
|
|
||||||
assert result["type"] == "abort"
|
|
||||||
assert result["reason"] == "missing_configuration"
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"nest_test_config,auth_implementation", [(TEST_CONFIG_HYBRID, APP_AUTH_DOMAIN)]
|
"nest_test_config,auth_implementation", [(TEST_CONFIG_HYBRID, APP_AUTH_DOMAIN)]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue