Adjust async_step_reauth in blink (#74167)

This commit is contained in:
epenet 2022-06-29 11:54:21 +02:00 committed by GitHub
parent 2fce301b34
commit 078c5cea86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,9 @@
"""Config flow to configure Blink."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
from blinkpy.auth import Auth, LoginError, TokenRefreshFailed
from blinkpy.blinkpy import Blink, BlinkSetupError
@ -15,6 +17,7 @@ from homeassistant.const import (
CONF_USERNAME,
)
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult
from .const import DEFAULT_SCAN_INTERVAL, DEVICE_ID, DOMAIN
@ -120,9 +123,9 @@ class BlinkConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
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."""
return await self.async_step_user(entry_data)
return await self.async_step_user(dict(entry_data))
@callback
def _async_finish_flow(self):

View File

@ -246,7 +246,9 @@ async def test_form_unknown_error(hass):
async def test_reauth_shows_user_step(hass):
"""Test reauth shows the user form."""
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["step_id"] == "user"