Remove a redundant check in APCUPSD's config flow (#113032)
Remove a redundant check that is impossible to happen in practice
This commit is contained in:
parent
4b84954d17
commit
405bf076b2
3 changed files with 1 additions and 16 deletions
|
@ -61,9 +61,6 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
step_id="user", data_schema=_SCHEMA, errors=errors
|
||||
)
|
||||
|
||||
if not data:
|
||||
return self.async_abort(reason="no_status")
|
||||
|
||||
# We _try_ to use the serial number of the UPS as the unique id since this field
|
||||
# is not guaranteed to exist on all APC UPS models.
|
||||
await self.async_set_unique_id(data.serial_no)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||
"no_status": "No status is reported from host"
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
|
|
|
@ -37,17 +37,6 @@ async def test_config_flow_cannot_connect(hass: HomeAssistant) -> None:
|
|||
assert result["errors"]["base"] == "cannot_connect"
|
||||
|
||||
|
||||
async def test_config_flow_no_status(hass: HomeAssistant) -> None:
|
||||
"""Test config flow setup with successful connection but no status is reported."""
|
||||
with patch("aioapcaccess.request_status", return_value={}): # Returns no status.
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "no_status"
|
||||
|
||||
|
||||
async def test_config_flow_duplicate(hass: HomeAssistant) -> None:
|
||||
"""Test duplicate config flow setup."""
|
||||
# First add an exiting config entry to hass.
|
||||
|
|
Loading…
Add table
Reference in a new issue