mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Adjust async_step_reauth in blink (#74167)
This commit is contained in:
parent
2fce301b34
commit
078c5cea86
@ -1,7 +1,9 @@
|
|||||||
"""Config flow to configure Blink."""
|
"""Config flow to configure Blink."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from blinkpy.auth import Auth, LoginError, TokenRefreshFailed
|
from blinkpy.auth import Auth, LoginError, TokenRefreshFailed
|
||||||
from blinkpy.blinkpy import Blink, BlinkSetupError
|
from blinkpy.blinkpy import Blink, BlinkSetupError
|
||||||
@ -15,6 +17,7 @@ from homeassistant.const import (
|
|||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
|
|
||||||
from .const import DEFAULT_SCAN_INTERVAL, DEVICE_ID, DOMAIN
|
from .const import DEFAULT_SCAN_INTERVAL, DEVICE_ID, DOMAIN
|
||||||
|
|
||||||
@ -120,9 +123,9 @@ class BlinkConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_reauth(self, entry_data):
|
async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
|
||||||
"""Perform reauth upon migration of old entries."""
|
"""Perform reauth upon migration of old entries."""
|
||||||
return await self.async_step_user(entry_data)
|
return await self.async_step_user(dict(entry_data))
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_finish_flow(self):
|
def _async_finish_flow(self):
|
||||||
|
@ -246,7 +246,9 @@ async def test_form_unknown_error(hass):
|
|||||||
async def test_reauth_shows_user_step(hass):
|
async def test_reauth_shows_user_step(hass):
|
||||||
"""Test reauth shows the user form."""
|
"""Test reauth shows the user form."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_REAUTH}
|
DOMAIN,
|
||||||
|
context={"source": config_entries.SOURCE_REAUTH},
|
||||||
|
data={"username": "blink@example.com", "password": "invalid_password"},
|
||||||
)
|
)
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user