Standardize reauth step variable name in permobil (#124764)

This commit is contained in:
epenet 2024-08-28 13:02:21 +02:00 committed by GitHub
parent 51a5a78eb5
commit 274d98f4d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 8 deletions

View file

@ -161,17 +161,12 @@ class PermobilConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=self.data[CONF_EMAIL], data=self.data)
async def async_step_reauth(
self, user_input: Mapping[str, Any]
self, entry_data: Mapping[str, Any]
) -> ConfigFlowResult:
"""Perform reauth upon an API authentication error."""
reauth_entry = self.hass.config_entries.async_get_entry(
self.context["entry_id"]
)
assert reauth_entry
try:
email: str = reauth_entry.data[CONF_EMAIL]
region: str = reauth_entry.data[CONF_REGION]
email: str = entry_data[CONF_EMAIL]
region: str = entry_data[CONF_REGION]
self.p_api.set_email(email)
self.p_api.set_region(region)
self.data = {

View file

@ -287,6 +287,7 @@ async def test_config_flow_reauth_success(
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN,
context={"source": "reauth", "entry_id": mock_entry.entry_id},
data=mock_entry.data,
)
assert result["type"] is FlowResultType.FORM
@ -329,6 +330,7 @@ async def test_config_flow_reauth_fail_invalid_code(
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN,
context={"source": "reauth", "entry_id": mock_entry.entry_id},
data=mock_entry.data,
)
assert result["type"] is FlowResultType.FORM
@ -366,6 +368,7 @@ async def test_config_flow_reauth_fail_code_request(
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN,
context={"source": "reauth", "entry_id": reauth_entry.entry_id},
data=mock_entry.data,
)
assert result["type"] is FlowResultType.ABORT