Use reference strings in Upb (#41340)

* Update strings.json

* Update config_flow.py

* Update test_config_flow.py
This commit is contained in:
SNoof85 2020-10-06 19:57:38 +02:00 committed by GitHub
parent f256d0a4ea
commit ba81c0c043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -89,7 +89,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
if user_input is not None:
try:
if self._url_already_configured(_make_url_from_data(user_input)):
return self.async_abort(reason="address_already_configured")
return self.async_abort(reason="already_configured")
network_id, info = await _validate_input(user_input)
except CannotConnect:
errors["base"] = "cannot_connect"

View File

@ -12,12 +12,12 @@
}
},
"error": {
"cannot_connect": "Failed to connect to UPB PIM, please try again.",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_upb_file": "Missing or invalid UPB UPStart export file, check the name and path of the file.",
"unknown": "Unexpected error."
"unknown": "[%key:common::config_flow::error::unknown%]"
},
"abort": {
"address_already_configured": "An UPB PIM with this address is already configured."
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
}
}
}

View File

@ -107,7 +107,7 @@ async def test_form_user_with_already_configured(hass):
_ = await valid_tcp_flow(hass)
result2 = await valid_tcp_flow(hass)
assert result2["type"] == "abort"
assert result2["reason"] == "address_already_configured"
assert result2["reason"] == "already_configured"
await hass.async_block_till_done()