From ba76bbee44a553795704ea41355bb3088042c1f3 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 1 Jun 2023 11:33:37 +0200 Subject: [PATCH] Remove async_setup from zerproc (#93903) --- homeassistant/components/zerproc/__init__.py | 12 +----------- tests/components/zerproc/test_config_flow.py | 9 --------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/homeassistant/components/zerproc/__init__.py b/homeassistant/components/zerproc/__init__.py index 43a768c3844..edd41d1a8e3 100644 --- a/homeassistant/components/zerproc/__init__.py +++ b/homeassistant/components/zerproc/__init__.py @@ -1,23 +1,13 @@ """Zerproc lights integration.""" -from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry +from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform from homeassistant.core import HomeAssistant -from homeassistant.helpers.typing import ConfigType from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN PLATFORMS = [Platform.LIGHT] -async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: - """Set up the Zerproc platform.""" - hass.async_create_task( - hass.config_entries.flow.async_init(DOMAIN, context={"source": SOURCE_IMPORT}) - ) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Zerproc from a config entry.""" if DOMAIN not in hass.data: diff --git a/tests/components/zerproc/test_config_flow.py b/tests/components/zerproc/test_config_flow.py index 43988836416..0a493929b67 100644 --- a/tests/components/zerproc/test_config_flow.py +++ b/tests/components/zerproc/test_config_flow.py @@ -21,8 +21,6 @@ async def test_flow_success(hass: HomeAssistant) -> None: "homeassistant.components.zerproc.config_flow.pyzerproc.discover", return_value=["Light1", "Light2"], ), patch( - "homeassistant.components.zerproc.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.zerproc.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -36,7 +34,6 @@ async def test_flow_success(hass: HomeAssistant) -> None: assert result2["title"] == "Zerproc" assert result2["data"] == {} - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -53,8 +50,6 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> None: "homeassistant.components.zerproc.config_flow.pyzerproc.discover", return_value=[], ), patch( - "homeassistant.components.zerproc.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.zerproc.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -66,7 +61,6 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> None: assert result2["type"] == "abort" assert result2["reason"] == "no_devices_found" await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 0 assert len(mock_setup_entry.mock_calls) == 0 @@ -83,8 +77,6 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> None: "homeassistant.components.zerproc.config_flow.pyzerproc.discover", side_effect=pyzerproc.ZerprocException("TEST"), ), patch( - "homeassistant.components.zerproc.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.zerproc.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -96,5 +88,4 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> None: assert result2["type"] == "abort" assert result2["reason"] == "no_devices_found" await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 0 assert len(mock_setup_entry.mock_calls) == 0