mirror of https://github.com/home-assistant/core
Review: fix config_flow.validate_input/retactor following lib bump
This commit is contained in:
parent
030c1b77e2
commit
14ca00a3c5
|
@ -47,10 +47,7 @@ async def validate_input(hass: HomeAssistant, user_input: dict[str, Any]) -> Non
|
|||
if data.get("errors"):
|
||||
_LOGGER.warning(data["errors"])
|
||||
|
||||
try:
|
||||
data["data"]["Catalog"]["searchStore"]["elements"]
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise CannotConnect
|
||||
assert data["data"]["Catalog"]["searchStore"]["elements"]
|
||||
|
||||
|
||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
@ -76,8 +73,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
try:
|
||||
await validate_input(self.hass, user_input)
|
||||
except CannotConnect:
|
||||
errors["base"] = "cannot_connect"
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unexpected exception")
|
||||
errors["base"] = "unknown"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
}
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"abort": {
|
||||
|
|
|
@ -97,7 +97,7 @@ async def test_form_cannot_connect_wrong_param(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "cannot_connect"}
|
||||
assert result2["errors"] == {"base": "unknown"}
|
||||
|
||||
|
||||
async def test_form_service_error(hass: HomeAssistant) -> None:
|
||||
|
|
Loading…
Reference in New Issue