Use Mapping for async_step_reauth in discord (#72812)
* Fix tests * Cleanup code accordingly
This commit is contained in:
parent
9ac0c5907f
commit
1aeba8a9bd
2 changed files with 5 additions and 12 deletions
|
@ -1,7 +1,9 @@
|
|||
"""Config flow for Discord integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aiohttp.client_exceptions import ClientConnectorError
|
||||
import nextcord
|
||||
|
@ -21,13 +23,9 @@ CONFIG_SCHEMA = vol.Schema({vol.Required(CONF_API_TOKEN): str})
|
|||
class DiscordFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a config flow for Discord."""
|
||||
|
||||
async def async_step_reauth(self, user_input: dict | None = None) -> FlowResult:
|
||||
async def async_step_reauth(self, data: Mapping[str, Any]) -> FlowResult:
|
||||
"""Handle a reauthorization flow request."""
|
||||
if user_input is not None:
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
self._set_confirm_only()
|
||||
return self.async_show_form(step_id="reauth")
|
||||
return await self.async_step_reauth_confirm()
|
||||
|
||||
async def async_step_reauth_confirm(
|
||||
self, user_input: dict[str, str] | None = None
|
||||
|
|
|
@ -128,14 +128,9 @@ async def test_flow_reauth(hass: HomeAssistant) -> None:
|
|||
"entry_id": entry.entry_id,
|
||||
"unique_id": entry.unique_id,
|
||||
},
|
||||
data=entry.data,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue