mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use common strings in adguard config flow (#40942)
This commit is contained in:
parent
75a6dacaba
commit
1b864aeccc
@ -80,7 +80,7 @@ class AdGuardHomeFlowHandler(ConfigFlow):
|
|||||||
try:
|
try:
|
||||||
await adguard.version()
|
await adguard.version()
|
||||||
except AdGuardHomeConnectionError:
|
except AdGuardHomeConnectionError:
|
||||||
errors["base"] = "connection_error"
|
errors["base"] = "cannot_connect"
|
||||||
return await self._show_setup_form(errors)
|
return await self._show_setup_form(errors)
|
||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
@ -152,7 +152,7 @@ class AdGuardHomeFlowHandler(ConfigFlow):
|
|||||||
try:
|
try:
|
||||||
await adguard.version()
|
await adguard.version()
|
||||||
except AdGuardHomeConnectionError:
|
except AdGuardHomeConnectionError:
|
||||||
errors["base"] = "connection_error"
|
errors["base"] = "cannot_connect"
|
||||||
return await self._show_hassio_form(errors)
|
return await self._show_hassio_form(errors)
|
||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
|
@ -17,10 +17,12 @@
|
|||||||
"description": "Do you want to configure Home Assistant to connect to the AdGuard Home provided by the Hass.io add-on: {addon}?"
|
"description": "Do you want to configure Home Assistant to connect to the AdGuard Home provided by the Hass.io add-on: {addon}?"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": { "connection_error": "Failed to connect." },
|
"error": {
|
||||||
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||||
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"existing_instance_updated": "Updated existing configuration.",
|
"existing_instance_updated": "Updated existing configuration.",
|
||||||
"single_instance_allowed": "Only a single configuration of AdGuard Home is allowed."
|
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ async def test_connection_error(hass, aioclient_mock):
|
|||||||
|
|
||||||
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"
|
||||||
assert result["errors"] == {"base": "connection_error"}
|
assert result["errors"] == {"base": "cannot_connect"}
|
||||||
|
|
||||||
|
|
||||||
async def test_full_flow_implementation(hass, aioclient_mock):
|
async def test_full_flow_implementation(hass, aioclient_mock):
|
||||||
@ -235,4 +235,4 @@ async def test_hassio_connection_error(hass, aioclient_mock):
|
|||||||
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||||
assert result["step_id"] == "hassio_confirm"
|
assert result["step_id"] == "hassio_confirm"
|
||||||
assert result["errors"] == {"base": "connection_error"}
|
assert result["errors"] == {"base": "cannot_connect"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user