Address late review of AsusWRT unique id PR (#71281)

This commit is contained in:
ollo69 2022-05-04 11:39:55 +02:00 committed by GitHub
parent 9e2f0b3af1
commit ee8eac10c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 8 deletions

View file

@ -149,10 +149,10 @@ class AsusWrtFlowHandler(ConfigFlow, domain=DOMAIN):
) -> FlowResult:
"""Handle a flow initiated by the user."""
# if exist one entry without unique ID, we abort config flow
# if there's one entry without unique ID, we abort config flow
for unique_id in self._async_current_ids():
if unique_id is None:
return self.async_abort(reason="not_unique_id_exist")
return self.async_abort(reason="no_unique_id")
if user_input is None:
return self._show_setup_form(user_input)
@ -188,7 +188,7 @@ class AsusWrtFlowHandler(ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="invalid_unique_id")
else:
_LOGGER.warning(
"This device do not provide a valid Unique ID."
"This device does not provide a valid Unique ID."
" Configuration of multiple instance will not be possible"
)

View file

@ -26,7 +26,7 @@
},
"abort": {
"invalid_unique_id": "Impossible to determine a valid unique id for the device",
"not_unique_id_exist": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible"
"no_unique_id": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible"
}
},
"options": {

View file

@ -2,8 +2,7 @@
"config": {
"abort": {
"invalid_unique_id": "Impossible to determine a valid unique id for the device",
"not_unique_id_exist": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible",
"single_instance_allowed": "Already configured. Only a single configuration possible."
"no_unique_id": "A device without a valid unique id is already configured. Configuration of multiple instance is not possible"
},
"error": {
"cannot_connect": "Failed to connect",
@ -44,4 +43,4 @@
}
}
}
}
}

View file

@ -169,7 +169,7 @@ async def test_abort_if_not_unique_id_setup(hass):
data=CONFIG_DATA,
)
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "not_unique_id_exist"
assert result["reason"] == "no_unique_id"
@pytest.mark.usefixtures("connect")