Use reference strings in Tesla (#41238)
parent
5745e64cab
commit
f679acd3fa
|
@ -62,7 +62,7 @@ class TeslaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=DATA_SCHEMA,
|
data_schema=DATA_SCHEMA,
|
||||||
errors={CONF_USERNAME: "identifier_exists"},
|
errors={CONF_USERNAME: "already_configured_account"},
|
||||||
description_placeholders={},
|
description_placeholders={},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -72,14 +72,14 @@ class TeslaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=DATA_SCHEMA,
|
data_schema=DATA_SCHEMA,
|
||||||
errors={"base": "connection_error"},
|
errors={"base": "cannot_connect"},
|
||||||
description_placeholders={},
|
description_placeholders={},
|
||||||
)
|
)
|
||||||
except InvalidAuth:
|
except InvalidAuth:
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=DATA_SCHEMA,
|
data_schema=DATA_SCHEMA,
|
||||||
errors={"base": "invalid_credentials"},
|
errors={"base": "invalid_auth"},
|
||||||
description_placeholders={},
|
description_placeholders={},
|
||||||
)
|
)
|
||||||
return self.async_create_entry(title=user_input[CONF_USERNAME], data=info)
|
return self.async_create_entry(title=user_input[CONF_USERNAME], data=info)
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"error": {
|
"error": {
|
||||||
"connection_error": "Error connecting; check network and retry",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"identifier_exists": "Email already registered",
|
"already_configured_account": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||||
"invalid_credentials": "Invalid credentials",
|
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
|
||||||
"unknown_error": "Unknown error, please report log info"
|
|
||||||
},
|
},
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -27,4 +26,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ async def test_form_invalid_auth(hass):
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result2["type"] == "form"
|
assert result2["type"] == "form"
|
||||||
assert result2["errors"] == {"base": "invalid_credentials"}
|
assert result2["errors"] == {"base": "invalid_auth"}
|
||||||
|
|
||||||
|
|
||||||
async def test_form_cannot_connect(hass):
|
async def test_form_cannot_connect(hass):
|
||||||
|
@ -89,7 +89,7 @@ async def test_form_cannot_connect(hass):
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result2["type"] == "form"
|
assert result2["type"] == "form"
|
||||||
assert result2["errors"] == {"base": "connection_error"}
|
assert result2["errors"] == {"base": "cannot_connect"}
|
||||||
|
|
||||||
|
|
||||||
async def test_form_repeat_identifier(hass):
|
async def test_form_repeat_identifier(hass):
|
||||||
|
@ -110,7 +110,7 @@ async def test_form_repeat_identifier(hass):
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result2["type"] == "form"
|
assert result2["type"] == "form"
|
||||||
assert result2["errors"] == {CONF_USERNAME: "identifier_exists"}
|
assert result2["errors"] == {CONF_USERNAME: "already_configured_account"}
|
||||||
|
|
||||||
|
|
||||||
async def test_import(hass):
|
async def test_import(hass):
|
||||||
|
|
Loading…
Reference in New Issue