From bb9da22a8487dcfc51170c8c3070fdb4b079fc88 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 30 Mar 2021 01:23:44 +0200 Subject: [PATCH] Clean up superfluous integration setup - part 3 (#48484) --- .../components/advantage_air/__init__.py | 7 +----- homeassistant/components/aemet/__init__.py | 7 +----- homeassistant/components/aurora/__init__.py | 8 +----- homeassistant/components/blink/__init__.py | 9 ++----- homeassistant/components/bond/__init__.py | 7 +----- homeassistant/components/bsblan/__init__.py | 6 ----- .../components/climacell/__init__.py | 7 +----- homeassistant/components/control4/__init__.py | 10 +------- .../components/coolmaster/__init__.py | 7 +----- homeassistant/components/dexcom/__init__.py | 7 +----- homeassistant/components/directv/__init__.py | 7 +----- tests/components/aemet/test_config_flow.py | 3 --- tests/components/aurora/test_config_flow.py | 3 --- tests/components/blink/test_config_flow.py | 22 +++------------- tests/components/bond/test_config_flow.py | 25 ++++++------------- tests/components/control4/test_config_flow.py | 3 --- .../components/coolmaster/test_config_flow.py | 3 --- tests/components/dexcom/test_config_flow.py | 3 --- tests/components/directv/test_config_flow.py | 4 +-- 19 files changed, 23 insertions(+), 125 deletions(-) diff --git a/homeassistant/components/advantage_air/__init__.py b/homeassistant/components/advantage_air/__init__.py index 29270640a61..98c6c401810 100644 --- a/homeassistant/components/advantage_air/__init__.py +++ b/homeassistant/components/advantage_air/__init__.py @@ -18,12 +18,6 @@ PLATFORMS = ["climate", "cover", "binary_sensor", "sensor", "switch"] _LOGGER = logging.getLogger(__name__) -async def async_setup(hass, config): - """Set up Advantage Air integration.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass, entry): """Set up Advantage Air config.""" ip_address = entry.data[CONF_IP_ADDRESS] @@ -58,6 +52,7 @@ async def async_setup_entry(hass, entry): await coordinator.async_config_entry_first_refresh() + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { "coordinator": coordinator, "async_change": async_change, diff --git a/homeassistant/components/aemet/__init__.py b/homeassistant/components/aemet/__init__.py index 6ec6c6ed1ea..4c1315d187d 100644 --- a/homeassistant/components/aemet/__init__.py +++ b/homeassistant/components/aemet/__init__.py @@ -14,12 +14,6 @@ from .weather_update_coordinator import WeatherUpdateCoordinator _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, config: dict) -> bool: - """Set up the AEMET OpenData component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry): """Set up AEMET OpenData as config entry.""" name = config_entry.data[CONF_NAME] @@ -32,6 +26,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry): await weather_coordinator.async_config_entry_first_refresh() + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][config_entry.entry_id] = { ENTRY_NAME: name, ENTRY_WEATHER_COORDINATOR: weather_coordinator, diff --git a/homeassistant/components/aurora/__init__.py b/homeassistant/components/aurora/__init__.py index d685a983208..8823cf1c8ec 100644 --- a/homeassistant/components/aurora/__init__.py +++ b/homeassistant/components/aurora/__init__.py @@ -36,13 +36,6 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["binary_sensor", "sensor"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Aurora component.""" - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Aurora from a config entry.""" @@ -70,6 +63,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): await coordinator.async_config_entry_first_refresh() + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { COORDINATOR: coordinator, AURORA_API: api, diff --git a/homeassistant/components/blink/__init__.py b/homeassistant/components/blink/__init__.py index 1cef331c0bb..d53bcf6db08 100644 --- a/homeassistant/components/blink/__init__.py +++ b/homeassistant/components/blink/__init__.py @@ -59,12 +59,6 @@ def _reauth_flow_wrapper(hass, data): ) -async def async_setup(hass, config): - """Set up a Blink component.""" - hass.data[DOMAIN] = {} - return True - - async def async_migrate_entry(hass, entry): """Handle migration of a previous version config entry.""" _LOGGER.debug("Migrating from version %s", entry.version) @@ -81,8 +75,9 @@ async def async_migrate_entry(hass, entry): async def async_setup_entry(hass, entry): """Set up Blink via config entry.""" - _async_import_options_from_data_if_missing(hass, entry) + hass.data.setdefault(DOMAIN, {}) + _async_import_options_from_data_if_missing(hass, entry) hass.data[DOMAIN][entry.entry_id] = await hass.async_add_executor_job( _blink_startup_wrapper, hass, entry ) diff --git a/homeassistant/components/bond/__init__.py b/homeassistant/components/bond/__init__.py index 9ec0c662b8e..0fafb61df35 100644 --- a/homeassistant/components/bond/__init__.py +++ b/homeassistant/components/bond/__init__.py @@ -19,12 +19,6 @@ PLATFORMS = ["cover", "fan", "light", "switch"] _API_TIMEOUT = SLOW_UPDATE_WARNING - 1 -async def async_setup(hass: HomeAssistant, config: dict) -> bool: - """Set up the Bond component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Bond from a config entry.""" host = entry.data[CONF_HOST] @@ -41,6 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: bpup_subs = BPUPSubscriptions() stop_bpup = await start_bpup(host, bpup_subs) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { HUB: hub, BPUP_SUBS: bpup_subs, diff --git a/homeassistant/components/bsblan/__init__.py b/homeassistant/components/bsblan/__init__.py index bab4af29422..f452451050b 100644 --- a/homeassistant/components/bsblan/__init__.py +++ b/homeassistant/components/bsblan/__init__.py @@ -9,18 +9,12 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNA from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession -from homeassistant.helpers.typing import ConfigType from .const import CONF_PASSKEY, DATA_BSBLAN_CLIENT, DOMAIN SCAN_INTERVAL = timedelta(seconds=30) -async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: - """Set up the BSB-Lan component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up BSB-Lan from a config entry.""" diff --git a/homeassistant/components/climacell/__init__.py b/homeassistant/components/climacell/__init__.py index 4adddf71c79..1498c51f54a 100644 --- a/homeassistant/components/climacell/__init__.py +++ b/homeassistant/components/climacell/__init__.py @@ -25,7 +25,7 @@ from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME from homeassistant.helpers.aiohttp_client import async_get_clientsession -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -81,11 +81,6 @@ def _set_update_interval( return interval -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: - """Set up the ClimaCell API component.""" - return True - - async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool: """Set up ClimaCell API from a config entry.""" hass.data.setdefault(DOMAIN, {}) diff --git a/homeassistant/components/control4/__init__.py b/homeassistant/components/control4/__init__.py index 7f8ec09cdde..d7f8ec52f7a 100644 --- a/homeassistant/components/control4/__init__.py +++ b/homeassistant/components/control4/__init__.py @@ -42,17 +42,9 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["light"] -async def async_setup(hass: HomeAssistant, entry: ConfigEntry) -> bool: - """Stub to allow setting up this component. - - Configuration through YAML is not supported at this time. - """ - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Control4 from a config entry.""" + hass.data.setdefault(DOMAIN, {}) entry_data = hass.data[DOMAIN].setdefault(entry.entry_id, {}) account_session = aiohttp_client.async_get_clientsession(hass) diff --git a/homeassistant/components/coolmaster/__init__.py b/homeassistant/components/coolmaster/__init__.py index 2e1834ce8d8..2b092935bb0 100644 --- a/homeassistant/components/coolmaster/__init__.py +++ b/homeassistant/components/coolmaster/__init__.py @@ -13,12 +13,6 @@ from .const import DATA_COORDINATOR, DATA_INFO, DOMAIN _LOGGER = logging.getLogger(__name__) -async def async_setup(hass, config): - """Set up Coolmaster components.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass, entry): """Set up Coolmaster from a config entry.""" host = entry.data[CONF_HOST] @@ -31,6 +25,7 @@ async def async_setup_entry(hass, entry): except (OSError, ConnectionRefusedError, TimeoutError) as error: raise ConfigEntryNotReady() from error coordinator = CoolmasterDataUpdateCoordinator(hass, coolmaster) + hass.data.setdefault(DOMAIN, {}) await coordinator.async_config_entry_first_refresh() hass.data[DOMAIN][entry.entry_id] = { DATA_INFO: info, diff --git a/homeassistant/components/dexcom/__init__.py b/homeassistant/components/dexcom/__init__.py index ad386bb701c..1630d4b9dfd 100644 --- a/homeassistant/components/dexcom/__init__.py +++ b/homeassistant/components/dexcom/__init__.py @@ -26,12 +26,6 @@ _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(seconds=180) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up configured Dexcom.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Dexcom from a config entry.""" try: @@ -57,6 +51,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): except SessionError as error: raise UpdateFailed(error) from error + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { COORDINATOR: DataUpdateCoordinator( hass, diff --git a/homeassistant/components/directv/__init__.py b/homeassistant/components/directv/__init__.py index 7ede8fae946..f1f05e815a8 100644 --- a/homeassistant/components/directv/__init__.py +++ b/homeassistant/components/directv/__init__.py @@ -30,12 +30,6 @@ PLATFORMS = ["media_player", "remote"] SCAN_INTERVAL = timedelta(seconds=30) -async def async_setup(hass: HomeAssistant, config: dict) -> bool: - """Set up the DirecTV component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up DirecTV from a config entry.""" dtv = DIRECTV(entry.data[CONF_HOST], session=async_get_clientsession(hass)) @@ -45,6 +39,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: except DIRECTVError as err: raise ConfigEntryNotReady from err + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = dtv for platform in PLATFORMS: diff --git a/tests/components/aemet/test_config_flow.py b/tests/components/aemet/test_config_flow.py index 3c93a9d6321..be01ac9de07 100644 --- a/tests/components/aemet/test_config_flow.py +++ b/tests/components/aemet/test_config_flow.py @@ -26,8 +26,6 @@ async def test_form(hass): """Test that the form is served with valid input.""" with patch( - "homeassistant.components.aemet.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.aemet.async_setup_entry", return_value=True, ) as mock_setup_entry, requests_mock.mock() as _m: @@ -57,7 +55,6 @@ async def test_form(hass): assert result["data"][CONF_LONGITUDE] == CONFIG[CONF_LONGITUDE] assert result["data"][CONF_API_KEY] == CONFIG[CONF_API_KEY] - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/aurora/test_config_flow.py b/tests/components/aurora/test_config_flow.py index d9d0c4fd128..d839b024468 100644 --- a/tests/components/aurora/test_config_flow.py +++ b/tests/components/aurora/test_config_flow.py @@ -29,8 +29,6 @@ async def test_form(hass): "homeassistant.components.aurora.config_flow.AuroraForecast.get_forecast_data", return_value=True, ), patch( - "homeassistant.components.aurora.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.aurora.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -43,7 +41,6 @@ async def test_form(hass): assert result2["type"] == "create_entry" assert result2["title"] == "Aurora - Home" assert result2["data"] == DATA - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/blink/test_config_flow.py b/tests/components/blink/test_config_flow.py index f7dc89b4cbb..2d1746b87ba 100644 --- a/tests/components/blink/test_config_flow.py +++ b/tests/components/blink/test_config_flow.py @@ -23,8 +23,6 @@ async def test_form(hass): "homeassistant.components.blink.config_flow.Auth.check_key_required", return_value=False, ), patch( - "homeassistant.components.blink.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.blink.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -47,7 +45,6 @@ async def test_form(hass): "client_id": None, "region_id": None, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -61,9 +58,7 @@ async def test_form_2fa(hass): with patch("homeassistant.components.blink.config_flow.Auth.startup"), patch( "homeassistant.components.blink.config_flow.Auth.check_key_required", return_value=True, - ), patch( - "homeassistant.components.blink.async_setup", return_value=True - ) as mock_setup: + ): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"username": "blink@example.com", "password": "example"}, @@ -82,8 +77,6 @@ async def test_form_2fa(hass): "homeassistant.components.blink.config_flow.Blink.setup_urls", return_value=True, ), patch( - "homeassistant.components.blink.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.blink.async_setup_entry", return_value=True ) as mock_setup_entry: result3 = await hass.config_entries.flow.async_configure( @@ -94,7 +87,6 @@ async def test_form_2fa(hass): assert result3["type"] == "create_entry" assert result3["title"] == "blink" assert result3["result"].unique_id == "blink@example.com" - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -108,7 +100,7 @@ async def test_form_2fa_connect_error(hass): with patch("homeassistant.components.blink.config_flow.Auth.startup"), patch( "homeassistant.components.blink.config_flow.Auth.check_key_required", return_value=True, - ), patch("homeassistant.components.blink.async_setup", return_value=True): + ): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"username": "blink@example.com", "password": "example"}, @@ -126,8 +118,6 @@ async def test_form_2fa_connect_error(hass): ), patch( "homeassistant.components.blink.config_flow.Blink.setup_urls", side_effect=BlinkSetupError, - ), patch( - "homeassistant.components.blink.async_setup", return_value=True ), patch( "homeassistant.components.blink.async_setup_entry", return_value=True ): @@ -149,7 +139,7 @@ async def test_form_2fa_invalid_key(hass): with patch("homeassistant.components.blink.config_flow.Auth.startup"), patch( "homeassistant.components.blink.config_flow.Auth.check_key_required", return_value=True, - ), patch("homeassistant.components.blink.async_setup", return_value=True): + ): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"username": "blink@example.com", "password": "example"}, @@ -167,8 +157,6 @@ async def test_form_2fa_invalid_key(hass): ), patch( "homeassistant.components.blink.config_flow.Blink.setup_urls", return_value=True, - ), patch( - "homeassistant.components.blink.async_setup", return_value=True ), patch( "homeassistant.components.blink.async_setup_entry", return_value=True ): @@ -190,7 +178,7 @@ async def test_form_2fa_unknown_error(hass): with patch("homeassistant.components.blink.config_flow.Auth.startup"), patch( "homeassistant.components.blink.config_flow.Auth.check_key_required", return_value=True, - ), patch("homeassistant.components.blink.async_setup", return_value=True): + ): result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {"username": "blink@example.com", "password": "example"}, @@ -208,8 +196,6 @@ async def test_form_2fa_unknown_error(hass): ), patch( "homeassistant.components.blink.config_flow.Blink.setup_urls", side_effect=KeyError, - ), patch( - "homeassistant.components.blink.async_setup", return_value=True ), patch( "homeassistant.components.blink.async_setup_entry", return_value=True ): diff --git a/tests/components/bond/test_config_flow.py b/tests/components/bond/test_config_flow.py index b77c316f152..89c183ec1ba 100644 --- a/tests/components/bond/test_config_flow.py +++ b/tests/components/bond/test_config_flow.py @@ -35,7 +35,7 @@ async def test_user_form(hass: core.HomeAssistant): return_value={"bondid": "test-bond-id"} ), patch_bond_device_ids( return_value=["f6776c11", "f6776c12"] - ), patch_bond_bridge(), patch_bond_device_properties(), patch_bond_device(), _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + ), patch_bond_bridge(), patch_bond_device_properties(), patch_bond_device(), _patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"}, @@ -48,7 +48,6 @@ async def test_user_form(hass: core.HomeAssistant): CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -71,7 +70,7 @@ async def test_user_form_with_non_bridge(hass: core.HomeAssistant): } ), patch_bond_bridge( return_value={} - ), _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + ), _patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"}, @@ -84,7 +83,6 @@ async def test_user_form_with_non_bridge(hass: core.HomeAssistant): CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -180,7 +178,7 @@ async def test_user_form_one_entry_per_device_allowed(hass: core.HomeAssistant): with patch_bond_version( return_value={"bondid": "already-registered-bond-id"} - ), patch_bond_bridge(), patch_bond_device_ids(), _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + ), patch_bond_bridge(), patch_bond_device_ids(), _patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_HOST: "some host", CONF_ACCESS_TOKEN: "test-token"}, @@ -190,7 +188,6 @@ async def test_user_form_one_entry_per_device_allowed(hass: core.HomeAssistant): assert result2["reason"] == "already_configured" await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 0 assert len(mock_setup_entry.mock_calls) == 0 @@ -207,7 +204,7 @@ async def test_zeroconf_form(hass: core.HomeAssistant): with patch_bond_version( return_value={"bondid": "test-bond-id"} - ), patch_bond_bridge(), patch_bond_device_ids(), _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + ), patch_bond_bridge(), patch_bond_device_ids(), _patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: "test-token"}, @@ -220,7 +217,6 @@ async def test_zeroconf_form(hass: core.HomeAssistant): CONF_HOST: "test-host", CONF_ACCESS_TOKEN: "test-token", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -237,7 +233,7 @@ async def test_zeroconf_form_token_unavailable(hass: core.HomeAssistant): assert result["type"] == "form" assert result["errors"] == {} - with patch_bond_version(), patch_bond_bridge(), patch_bond_device_ids(), _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + with patch_bond_version(), patch_bond_bridge(), patch_bond_device_ids(), _patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {CONF_ACCESS_TOKEN: "test-token"}, @@ -250,7 +246,6 @@ async def test_zeroconf_form_token_unavailable(hass: core.HomeAssistant): CONF_HOST: "test-host", CONF_ACCESS_TOKEN: "test-token", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -271,7 +266,7 @@ async def test_zeroconf_form_with_token_available(hass: core.HomeAssistant): assert result["type"] == "form" assert result["errors"] == {} - with _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + with _patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {}, @@ -284,7 +279,6 @@ async def test_zeroconf_form_with_token_available(hass: core.HomeAssistant): CONF_HOST: "test-host", CONF_ACCESS_TOKEN: "discovered-token", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -299,7 +293,7 @@ async def test_zeroconf_already_configured(hass: core.HomeAssistant): ) entry.add_to_hass(hass) - with _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + with _patch_async_setup_entry() as mock_setup_entry: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, @@ -314,7 +308,6 @@ async def test_zeroconf_already_configured(hass: core.HomeAssistant): assert entry.data["host"] == "updated-host" await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 0 assert len(mock_setup_entry.mock_calls) == 0 @@ -356,10 +349,6 @@ async def _help_test_form_unexpected_error( assert result2["errors"] == {"base": "unknown"} -def _patch_async_setup(): - return patch("homeassistant.components.bond.async_setup", return_value=True) - - def _patch_async_setup_entry(): return patch( "homeassistant.components.bond.async_setup_entry", diff --git a/tests/components/control4/test_config_flow.py b/tests/components/control4/test_config_flow.py index 48ff8201166..5ffdc4f1ea8 100644 --- a/tests/components/control4/test_config_flow.py +++ b/tests/components/control4/test_config_flow.py @@ -62,8 +62,6 @@ async def test_form(hass): "homeassistant.components.control4.config_flow.C4Director", return_value=c4_director, ), patch( - "homeassistant.components.control4.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.control4.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -85,7 +83,6 @@ async def test_form(hass): CONF_PASSWORD: "test-password", "controller_unique_id": "control4_model_00AA00AA00AA", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/coolmaster/test_config_flow.py b/tests/components/coolmaster/test_config_flow.py index 3dd0f27ecdf..1c2abaf8389 100644 --- a/tests/components/coolmaster/test_config_flow.py +++ b/tests/components/coolmaster/test_config_flow.py @@ -24,8 +24,6 @@ async def test_form(hass): "homeassistant.components.coolmaster.config_flow.CoolMasterNet.status", return_value={"test_id": "test_unit"}, ), patch( - "homeassistant.components.coolmaster.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.coolmaster.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -41,7 +39,6 @@ async def test_form(hass): "port": 10102, "supported_modes": AVAILABLE_MODES, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/dexcom/test_config_flow.py b/tests/components/dexcom/test_config_flow.py index 2e1dfbcdee5..65db7ca16ac 100644 --- a/tests/components/dexcom/test_config_flow.py +++ b/tests/components/dexcom/test_config_flow.py @@ -24,8 +24,6 @@ async def test_form(hass): "homeassistant.components.dexcom.config_flow.Dexcom.create_session", return_value="test_session_id", ), patch( - "homeassistant.components.dexcom.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.dexcom.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -38,7 +36,6 @@ async def test_form(hass): assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == CONFIG[CONF_USERNAME] assert result2["data"] == CONFIG - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/directv/test_config_flow.py b/tests/components/directv/test_config_flow.py index 3372d48aadb..8c2d190f014 100644 --- a/tests/components/directv/test_config_flow.py +++ b/tests/components/directv/test_config_flow.py @@ -229,9 +229,7 @@ async def test_full_user_flow_implementation( assert result["step_id"] == "user" user_input = MOCK_USER_INPUT.copy() - with patch( - "homeassistant.components.directv.async_setup_entry", return_value=True - ), patch("homeassistant.components.directv.async_setup", return_value=True): + with patch("homeassistant.components.directv.async_setup_entry", return_value=True): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=user_input,