From 405bf076b24524458384840658ae442eaf5c95b6 Mon Sep 17 00:00:00 2001 From: Yuxin Wang Date: Mon, 11 Mar 2024 03:38:44 -0400 Subject: [PATCH] Remove a redundant check in APCUPSD's config flow (#113032) Remove a redundant check that is impossible to happen in practice --- homeassistant/components/apcupsd/config_flow.py | 3 --- homeassistant/components/apcupsd/strings.json | 3 +-- tests/components/apcupsd/test_config_flow.py | 11 ----------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/homeassistant/components/apcupsd/config_flow.py b/homeassistant/components/apcupsd/config_flow.py index 8d15b0478dd..00f757a1fd7 100644 --- a/homeassistant/components/apcupsd/config_flow.py +++ b/homeassistant/components/apcupsd/config_flow.py @@ -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) diff --git a/homeassistant/components/apcupsd/strings.json b/homeassistant/components/apcupsd/strings.json index 15ffb928f00..93102ac1393 100644 --- a/homeassistant/components/apcupsd/strings.json +++ b/homeassistant/components/apcupsd/strings.json @@ -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%]" diff --git a/tests/components/apcupsd/test_config_flow.py b/tests/components/apcupsd/test_config_flow.py index 3b9b1ee6e2e..bed0e78ad55 100644 --- a/tests/components/apcupsd/test_config_flow.py +++ b/tests/components/apcupsd/test_config_flow.py @@ -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.