diff --git a/homeassistant/components/epson/__init__.py b/homeassistant/components/epson/__init__.py index 51d464dacb5..94254f64f88 100644 --- a/homeassistant/components/epson/__init__.py +++ b/homeassistant/components/epson/__init__.py @@ -32,12 +32,6 @@ async def validate_projector(hass: HomeAssistant, host, port): return epson_proj -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the epson component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up epson from a config entry.""" try: @@ -47,6 +41,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): except CannotConnect: _LOGGER.warning("Cannot connect to projector %s", entry.data[CONF_HOST]) return False + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = projector for platform in PLATFORMS: hass.async_create_task( diff --git a/homeassistant/components/faa_delays/__init__.py b/homeassistant/components/faa_delays/__init__.py index 2669105469e..6db9b667526 100644 --- a/homeassistant/components/faa_delays/__init__.py +++ b/homeassistant/components/faa_delays/__init__.py @@ -20,12 +20,6 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["binary_sensor"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the FAA Delays component.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up FAA Delays from a config entry.""" code = entry.data[CONF_ID] @@ -33,6 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): coordinator = FAADataUpdateCoordinator(hass, code) await coordinator.async_config_entry_first_refresh() + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = coordinator for platform in PLATFORMS: diff --git a/homeassistant/components/flume/__init__.py b/homeassistant/components/flume/__init__.py index fb87588ac82..9acc5756023 100644 --- a/homeassistant/components/flume/__init__.py +++ b/homeassistant/components/flume/__init__.py @@ -29,12 +29,6 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the flume component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up flume from a config entry.""" @@ -73,6 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): _LOGGER.error("Invalid credentials for flume: %s", ex) return False + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { FLUME_DEVICES: flume_devices, FLUME_AUTH: flume_auth, diff --git a/homeassistant/components/hvv_departures/__init__.py b/homeassistant/components/hvv_departures/__init__.py index c90e5cb6d9c..b3eb53bff7a 100644 --- a/homeassistant/components/hvv_departures/__init__.py +++ b/homeassistant/components/hvv_departures/__init__.py @@ -14,11 +14,6 @@ from .hub import GTIHub PLATFORMS = [DOMAIN_SENSOR, DOMAIN_BINARY_SENSOR] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the HVV component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up HVV from a config entry.""" diff --git a/homeassistant/components/keenetic_ndms2/__init__.py b/homeassistant/components/keenetic_ndms2/__init__.py index d0217b2a4f5..6156fb00d02 100644 --- a/homeassistant/components/keenetic_ndms2/__init__.py +++ b/homeassistant/components/keenetic_ndms2/__init__.py @@ -3,7 +3,7 @@ from homeassistant.components import binary_sensor, device_tracker from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_SCAN_INTERVAL -from homeassistant.core import Config, HomeAssistant +from homeassistant.core import HomeAssistant from .const import ( CONF_CONSIDER_HOME, @@ -23,15 +23,9 @@ from .router import KeeneticRouter PLATFORMS = [device_tracker.DOMAIN, binary_sensor.DOMAIN] -async def async_setup(hass: HomeAssistant, _config: Config) -> bool: - """Set up configured entries.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set up the component.""" - + hass.data.setdefault(DOMAIN, {}) async_add_defaults(hass, config_entry) router = KeeneticRouter(hass, config_entry) diff --git a/homeassistant/components/mill/__init__.py b/homeassistant/components/mill/__init__.py index 117f2bcb5aa..e58a7865e28 100644 --- a/homeassistant/components/mill/__init__.py +++ b/homeassistant/components/mill/__init__.py @@ -1,11 +1,6 @@ """The mill component.""" -async def async_setup(hass, config): - """Set up the Mill platform.""" - return True - - async def async_setup_entry(hass, entry): """Set up the Mill heater.""" hass.async_create_task( diff --git a/homeassistant/components/mullvad/__init__.py b/homeassistant/components/mullvad/__init__.py index 541c6075cc3..325c0603f32 100644 --- a/homeassistant/components/mullvad/__init__.py +++ b/homeassistant/components/mullvad/__init__.py @@ -15,11 +15,6 @@ from .const import DOMAIN PLATFORMS = ["binary_sensor"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Mullvad VPN integration.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: dict): """Set up Mullvad VPN integration.""" diff --git a/homeassistant/components/nightscout/__init__.py b/homeassistant/components/nightscout/__init__.py index dfaaf28048e..dd940531735 100644 --- a/homeassistant/components/nightscout/__init__.py +++ b/homeassistant/components/nightscout/__init__.py @@ -19,12 +19,6 @@ PLATFORMS = ["sensor"] _API_TIMEOUT = SLOW_UPDATE_WARNING - 1 -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Nightscout component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Nightscout from a config entry.""" server_url = entry.data[CONF_URL] @@ -36,6 +30,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): except (ClientError, AsyncIOTimeoutError, OSError) as error: raise ConfigEntryNotReady from error + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = api device_registry = await dr.async_get_registry(hass) diff --git a/homeassistant/components/nut/__init__.py b/homeassistant/components/nut/__init__.py index be86ca5951c..f526e49c6b8 100644 --- a/homeassistant/components/nut/__init__.py +++ b/homeassistant/components/nut/__init__.py @@ -37,13 +37,6 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Network UPS Tools (NUT) component.""" - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Network UPS Tools (NUT) from a config entry.""" @@ -90,6 +83,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): if unique_id is None: unique_id = entry.entry_id + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { COORDINATOR: coordinator, PYNUT_DATA: data, diff --git a/homeassistant/components/nws/__init__.py b/homeassistant/components/nws/__init__.py index 9cdf17fa264..5724175b4bb 100644 --- a/homeassistant/components/nws/__init__.py +++ b/homeassistant/components/nws/__init__.py @@ -40,11 +40,6 @@ def base_unique_id(latitude, longitude): return f"{latitude}_{longitude}" -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the National Weather Service (NWS) component.""" - return True - - class NwsDataUpdateCoordinator(DataUpdateCoordinator): """ NWS data update coordinator. diff --git a/homeassistant/components/omnilogic/__init__.py b/homeassistant/components/omnilogic/__init__.py index e5a545e4806..8c5d460e549 100644 --- a/homeassistant/components/omnilogic/__init__.py +++ b/homeassistant/components/omnilogic/__init__.py @@ -18,13 +18,6 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["sensor"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Omnilogic component.""" - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Omnilogic from a config entry.""" @@ -58,6 +51,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, OMNI_API: api, diff --git a/homeassistant/components/ondilo_ico/__init__.py b/homeassistant/components/ondilo_ico/__init__.py index 4dac83815ba..0975802b9b2 100644 --- a/homeassistant/components/ondilo_ico/__init__.py +++ b/homeassistant/components/ondilo_ico/__init__.py @@ -12,13 +12,6 @@ from .oauth_impl import OndiloOauth2Implementation PLATFORMS = ["sensor"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Ondilo ICO component.""" - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Ondilo ICO from a config entry.""" @@ -33,6 +26,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: ) ) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = api.OndiloClient(hass, entry, implementation) for platform in PLATFORMS: diff --git a/homeassistant/components/ozw/__init__.py b/homeassistant/components/ozw/__init__.py index ace71e4af81..c484eb4e0c0 100644 --- a/homeassistant/components/ozw/__init__.py +++ b/homeassistant/components/ozw/__init__.py @@ -56,14 +56,9 @@ DATA_DEVICES = "zwave-mqtt-devices" DATA_STOP_MQTT_CLIENT = "ozw_stop_mqtt_client" -async def async_setup(hass: HomeAssistant, config: dict): - """Initialize basic config of ozw component.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up ozw from a config entry.""" + hass.data.setdefault(DOMAIN, {}) ozw_data = hass.data[DOMAIN][entry.entry_id] = {} ozw_data[DATA_UNSUBSCRIBE] = [] diff --git a/homeassistant/components/roku/__init__.py b/homeassistant/components/roku/__init__.py index f8294c878dd..3a12de51b06 100644 --- a/homeassistant/components/roku/__init__.py +++ b/homeassistant/components/roku/__init__.py @@ -39,14 +39,9 @@ SCAN_INTERVAL = timedelta(seconds=15) _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistantType, config: dict) -> bool: - """Set up the Roku integration.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up Roku from a config entry.""" + hass.data.setdefault(DOMAIN, {}) coordinator = hass.data[DOMAIN].get(entry.entry_id) if not coordinator: coordinator = RokuDataUpdateCoordinator(hass, host=entry.data[CONF_HOST]) diff --git a/homeassistant/components/sentry/__init__.py b/homeassistant/components/sentry/__init__.py index c58d7bcd1a8..8a87cba84d7 100644 --- a/homeassistant/components/sentry/__init__.py +++ b/homeassistant/components/sentry/__init__.py @@ -40,11 +40,6 @@ CONFIG_SCHEMA = cv.deprecated(DOMAIN) LOGGER_INFO_REGEX = re.compile(r"^(\w+)\.?(\w+)?\.?(\w+)?\.?(\w+)?(?:\..*)?$") -async def async_setup(hass: HomeAssistant, config: dict) -> bool: - """Set up the Sentry component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Sentry from a config entry.""" diff --git a/homeassistant/components/smhi/__init__.py b/homeassistant/components/smhi/__init__.py index 6ede2e6b0ed..84151bd35ee 100644 --- a/homeassistant/components/smhi/__init__.py +++ b/homeassistant/components/smhi/__init__.py @@ -1,6 +1,6 @@ """Support for the Swedish weather institute weather service.""" from homeassistant.config_entries import ConfigEntry -from homeassistant.core import Config, HomeAssistant +from homeassistant.core import HomeAssistant # Have to import for config_flow to work even if they are not used here from .config_flow import smhi_locations # noqa: F401 @@ -9,12 +9,6 @@ from .const import DOMAIN # noqa: F401 DEFAULT_NAME = "smhi" -async def async_setup(hass: HomeAssistant, config: Config) -> bool: - """Set up configured SMHI.""" - # We allow setup only through config flow type of config - return True - - async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set up SMHI forecast as config entry.""" hass.async_create_task( diff --git a/homeassistant/components/solarlog/__init__.py b/homeassistant/components/solarlog/__init__.py index c8035e1f7e6..51aa21eb315 100644 --- a/homeassistant/components/solarlog/__init__.py +++ b/homeassistant/components/solarlog/__init__.py @@ -3,11 +3,6 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType -async def async_setup(hass, config): - """Component setup, do nothing.""" - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): """Set up a config entry for solarlog.""" hass.async_create_task( diff --git a/homeassistant/components/syncthru/__init__.py b/homeassistant/components/syncthru/__init__.py index 293680151ff..888dd22c090 100644 --- a/homeassistant/components/syncthru/__init__.py +++ b/homeassistant/components/syncthru/__init__.py @@ -10,23 +10,18 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_URL from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import aiohttp_client, device_registry as dr -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import HomeAssistantType from .const import DOMAIN _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: - """Set up.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up config entry.""" session = aiohttp_client.async_get_clientsession(hass) + hass.data.setdefault(DOMAIN, {}) printer = hass.data[DOMAIN][entry.entry_id] = SyncThru( entry.data[CONF_URL], session ) diff --git a/homeassistant/components/totalconnect/__init__.py b/homeassistant/components/totalconnect/__init__.py index 4078655f075..db0fa1e5755 100644 --- a/homeassistant/components/totalconnect/__init__.py +++ b/homeassistant/components/totalconnect/__init__.py @@ -33,13 +33,6 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up by configuration file.""" - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up upon config entry in user interface.""" conf = entry.data @@ -62,6 +55,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): if not client.is_valid_credentials(): raise ConfigEntryAuthFailed("TotalConnect authentication failed") + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = client for platform in PLATFORMS: diff --git a/homeassistant/components/wilight/__init__.py b/homeassistant/components/wilight/__init__.py index 3e14ea20b0c..88589f1ed70 100644 --- a/homeassistant/components/wilight/__init__.py +++ b/homeassistant/components/wilight/__init__.py @@ -14,14 +14,6 @@ DOMAIN = "wilight" PLATFORMS = ["cover", "fan", "light"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the WiLight with Config Flow component.""" - - hass.data[DOMAIN] = {} - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up a wilight config entry.""" @@ -30,6 +22,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): if not await parent.async_setup(): raise ConfigEntryNotReady + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = parent # Set up all platforms for this device/entry. diff --git a/tests/components/epson/test_config_flow.py b/tests/components/epson/test_config_flow.py index 4a0b9f9675f..849a88ba112 100644 --- a/tests/components/epson/test_config_flow.py +++ b/tests/components/epson/test_config_flow.py @@ -20,8 +20,6 @@ async def test_form(hass): "homeassistant.components.epson.Projector.get_property", return_value="04", ), patch( - "homeassistant.components.epson.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.epson.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -33,7 +31,6 @@ async def test_form(hass): assert result2["title"] == "test-epson" assert result2["data"] == {CONF_HOST: "1.1.1.1", CONF_PORT: 80} await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -61,7 +58,7 @@ async def test_import(hass): with patch( "homeassistant.components.epson.Projector.get_property", return_value="04", - ), patch("homeassistant.components.epson.async_setup", return_value=True), patch( + ), patch( "homeassistant.components.epson.async_setup_entry", return_value=True, ): diff --git a/tests/components/faa_delays/test_config_flow.py b/tests/components/faa_delays/test_config_flow.py index c289f154415..df79c3953c3 100644 --- a/tests/components/faa_delays/test_config_flow.py +++ b/tests/components/faa_delays/test_config_flow.py @@ -27,8 +27,6 @@ async def test_form(hass): assert result["errors"] == {} with patch.object(faadelays.Airport, "update", new=mock_valid_airport), patch( - "homeassistant.components.faa_delays.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.faa_delays.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -45,7 +43,6 @@ async def test_form(hass): "id": "test", } await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/flume/test_config_flow.py b/tests/components/flume/test_config_flow.py index 9ae0889d52c..3a9e3376f05 100644 --- a/tests/components/flume/test_config_flow.py +++ b/tests/components/flume/test_config_flow.py @@ -37,8 +37,6 @@ async def test_form(hass): "homeassistant.components.flume.config_flow.FlumeDeviceList", return_value=mock_flume_device_list, ), patch( - "homeassistant.components.flume.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.flume.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -61,7 +59,6 @@ async def test_form(hass): CONF_CLIENT_ID: "client_id", CONF_CLIENT_SECRET: "client_secret", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -77,8 +74,6 @@ async def test_form_import(hass): "homeassistant.components.flume.config_flow.FlumeDeviceList", return_value=mock_flume_device_list, ), patch( - "homeassistant.components.flume.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.flume.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -102,7 +97,6 @@ async def test_form_import(hass): CONF_CLIENT_ID: "client_id", CONF_CLIENT_SECRET: "client_secret", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/hvv_departures/test_config_flow.py b/tests/components/hvv_departures/test_config_flow.py index a6a927afd2e..3773dbb5967 100644 --- a/tests/components/hvv_departures/test_config_flow.py +++ b/tests/components/hvv_departures/test_config_flow.py @@ -38,8 +38,6 @@ async def test_user_flow(hass): ), patch( "homeassistant.components.hvv_departures.hub.GTI.stationInformation", return_value=FIXTURE_STATION_INFORMATION, - ), patch( - "homeassistant.components.hvv_departures.async_setup", return_value=True ), patch( "homeassistant.components.hvv_departures.async_setup_entry", return_value=True, @@ -101,8 +99,6 @@ async def test_user_flow_no_results(hass): ), patch( "homeassistant.components.hvv_departures.hub.GTI.checkName", return_value={"returnCode": "OK", "results": []}, - ), patch( - "homeassistant.components.hvv_departures.async_setup", return_value=True ), patch( "homeassistant.components.hvv_departures.async_setup_entry", return_value=True, diff --git a/tests/components/keenetic_ndms2/test_config_flow.py b/tests/components/keenetic_ndms2/test_config_flow.py index aa5369fdc0a..ae22ea31ffb 100644 --- a/tests/components/keenetic_ndms2/test_config_flow.py +++ b/tests/components/keenetic_ndms2/test_config_flow.py @@ -53,8 +53,6 @@ async def test_flow_works(hass: HomeAssistantType, connect): assert result["step_id"] == "user" with patch( - "homeassistant.components.keenetic_ndms2.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.keenetic_ndms2.async_setup_entry", return_value=True ) as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( @@ -66,7 +64,6 @@ async def test_flow_works(hass: HomeAssistantType, connect): assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == MOCK_NAME assert result2["data"] == MOCK_DATA - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -74,8 +71,6 @@ async def test_import_works(hass: HomeAssistantType, connect): """Test config flow.""" with patch( - "homeassistant.components.keenetic_ndms2.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.keenetic_ndms2.async_setup_entry", return_value=True ) as mock_setup_entry: result = await hass.config_entries.flow.async_init( @@ -88,7 +83,6 @@ async def test_import_works(hass: HomeAssistantType, connect): assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["title"] == MOCK_NAME assert result["data"] == MOCK_DATA - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -97,14 +91,11 @@ async def test_options(hass): entry = MockConfigEntry(domain=keenetic.DOMAIN, data=MOCK_DATA) entry.add_to_hass(hass) with patch( - "homeassistant.components.keenetic_ndms2.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.keenetic_ndms2.async_setup_entry", return_value=True ) as mock_setup_entry: await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 # fake router diff --git a/tests/components/mullvad/test_config_flow.py b/tests/components/mullvad/test_config_flow.py index c101e5a7246..e34af4eb83b 100644 --- a/tests/components/mullvad/test_config_flow.py +++ b/tests/components/mullvad/test_config_flow.py @@ -20,8 +20,6 @@ async def test_form_user(hass): assert not result["errors"] with patch( - "homeassistant.components.mullvad.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.mullvad.async_setup_entry", return_value=True, ) as mock_setup_entry, patch( @@ -36,7 +34,6 @@ async def test_form_user(hass): assert result2["type"] == "create_entry" assert result2["title"] == "Mullvad VPN" assert result2["data"] == {} - assert len(mock_setup.mock_calls) == 0 assert len(mock_setup_entry.mock_calls) == 1 assert len(mock_mullvad_api.mock_calls) == 1 diff --git a/tests/components/nightscout/test_config_flow.py b/tests/components/nightscout/test_config_flow.py index 9a86e14b4e5..9be3c95ef42 100644 --- a/tests/components/nightscout/test_config_flow.py +++ b/tests/components/nightscout/test_config_flow.py @@ -27,7 +27,7 @@ async def test_form(hass): assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["errors"] == {} - with _patch_glucose_readings(), _patch_server_status(), _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry: + with _patch_glucose_readings(), _patch_server_status(), _patch_async_setup_entry() as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( result["flow_id"], CONFIG, @@ -37,7 +37,6 @@ async def test_form(hass): assert result2["title"] == SERVER_STATUS.name # pylint: disable=maybe-no-member assert result2["data"] == CONFIG await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -116,10 +115,6 @@ async def test_user_form_duplicate(hass): assert result["reason"] == "already_configured" -def _patch_async_setup(): - return patch("homeassistant.components.nightscout.async_setup", return_value=True) - - def _patch_async_setup_entry(): return patch( "homeassistant.components.nightscout.async_setup_entry", diff --git a/tests/components/nut/test_config_flow.py b/tests/components/nut/test_config_flow.py index bbe975a67c0..8543c68c2b8 100644 --- a/tests/components/nut/test_config_flow.py +++ b/tests/components/nut/test_config_flow.py @@ -49,8 +49,6 @@ async def test_form_zeroconf(hass): "homeassistant.components.nut.PyNUTClient", return_value=mock_pynut, ), patch( - "homeassistant.components.nut.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nut.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -70,7 +68,6 @@ async def test_form_zeroconf(hass): "username": "test-username", } assert result3["result"].unique_id is None - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -108,8 +105,6 @@ async def test_form_user_one_ups(hass): "homeassistant.components.nut.PyNUTClient", return_value=mock_pynut, ), patch( - "homeassistant.components.nut.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nut.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -128,7 +123,6 @@ async def test_form_user_one_ups(hass): "resources": ["battery.voltage", "ups.status", "ups.status.display"], "username": "test-username", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -187,8 +181,6 @@ async def test_form_user_multiple_ups(hass): "homeassistant.components.nut.PyNUTClient", return_value=mock_pynut, ), patch( - "homeassistant.components.nut.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nut.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -208,7 +200,6 @@ async def test_form_user_multiple_ups(hass): "resources": ["battery.voltage"], "username": "test-username", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 2 @@ -251,8 +242,6 @@ async def test_form_user_one_ups_with_ignored_entry(hass): "homeassistant.components.nut.PyNUTClient", return_value=mock_pynut, ), patch( - "homeassistant.components.nut.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nut.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -271,7 +260,6 @@ async def test_form_user_one_ups_with_ignored_entry(hass): "resources": ["battery.voltage", "ups.status", "ups.status.display"], "username": "test-username", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nws/test_config_flow.py b/tests/components/nws/test_config_flow.py index 81be7360e87..6945cb380d3 100644 --- a/tests/components/nws/test_config_flow.py +++ b/tests/components/nws/test_config_flow.py @@ -20,8 +20,6 @@ async def test_form(hass, mock_simple_nws_config): assert result["errors"] == {} with patch( - "homeassistant.components.nws.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nws.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -38,7 +36,6 @@ async def test_form(hass, mock_simple_nws_config): "longitude": -90, "station": "ABC", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -85,8 +82,6 @@ async def test_form_already_configured(hass, mock_simple_nws_config): ) with patch( - "homeassistant.components.nws.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nws.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -97,7 +92,6 @@ async def test_form_already_configured(hass, mock_simple_nws_config): await hass.async_block_till_done() assert result2["type"] == "create_entry" - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 result = await hass.config_entries.flow.async_init( @@ -105,8 +99,6 @@ async def test_form_already_configured(hass, mock_simple_nws_config): ) with patch( - "homeassistant.components.nws.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nws.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -117,5 +109,4 @@ async def test_form_already_configured(hass, mock_simple_nws_config): assert result2["type"] == "abort" 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 diff --git a/tests/components/omnilogic/test_config_flow.py b/tests/components/omnilogic/test_config_flow.py index acf2df88610..eda83b45455 100644 --- a/tests/components/omnilogic/test_config_flow.py +++ b/tests/components/omnilogic/test_config_flow.py @@ -24,8 +24,6 @@ async def test_form(hass): "homeassistant.components.omnilogic.config_flow.OmniLogic.connect", return_value=True, ), patch( - "homeassistant.components.omnilogic.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.omnilogic.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -38,7 +36,6 @@ async def test_form(hass): assert result2["type"] == "create_entry" assert result2["title"] == "Omnilogic" assert result2["data"] == DATA - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/ozw/test_config_flow.py b/tests/components/ozw/test_config_flow.py index 0a746398cf9..6fdc86f710e 100644 --- a/tests/components/ozw/test_config_flow.py +++ b/tests/components/ozw/test_config_flow.py @@ -84,8 +84,6 @@ async def test_user_not_supervisor_create_entry(hass, mqtt): await setup.async_setup_component(hass, "persistent_notification", {}) with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -102,7 +100,6 @@ async def test_user_not_supervisor_create_entry(hass, mqtt): "use_addon": False, "integration_created_addon": False, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -136,8 +133,6 @@ async def test_not_addon(hass, supervisor, mqtt): ) with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -154,7 +149,6 @@ async def test_not_addon(hass, supervisor, mqtt): "use_addon": False, "integration_created_addon": False, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -169,8 +163,6 @@ async def test_addon_running(hass, supervisor, addon_running, addon_options): ) with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -187,7 +179,6 @@ async def test_addon_running(hass, supervisor, addon_running, addon_options): "use_addon": True, "integration_created_addon": False, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -222,8 +213,6 @@ async def test_addon_installed( ) with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -240,7 +229,6 @@ async def test_addon_installed( "use_addon": True, "integration_created_addon": False, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -319,8 +307,6 @@ async def test_addon_not_installed( assert result["step_id"] == "start_addon" with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -337,7 +323,6 @@ async def test_addon_not_installed( "use_addon": True, "integration_created_addon": True, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -379,8 +364,6 @@ async def test_supervisor_discovery(hass, supervisor, addon_running, addon_optio ) with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -395,7 +378,6 @@ async def test_supervisor_discovery(hass, supervisor, addon_running, addon_optio "use_addon": True, "integration_created_addon": False, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -421,8 +403,6 @@ async def test_clean_discovery_on_user_create( ) with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -440,7 +420,6 @@ async def test_clean_discovery_on_user_create( "use_addon": False, "integration_created_addon": False, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -562,8 +541,6 @@ async def test_import_addon_installed( default_input = result["data_schema"]({}) with patch( - "homeassistant.components.ozw.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ozw.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -580,5 +557,4 @@ async def test_import_addon_installed( "use_addon": True, "integration_created_addon": False, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/roku/test_config_flow.py b/tests/components/roku/test_config_flow.py index ed1b042e328..ab0072377cd 100644 --- a/tests/components/roku/test_config_flow.py +++ b/tests/components/roku/test_config_flow.py @@ -72,8 +72,6 @@ async def test_form( user_input = {CONF_HOST: HOST} with patch( - "homeassistant.components.roku.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.roku.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -88,7 +86,6 @@ async def test_form( assert result["data"] assert result["data"][CONF_HOST] == HOST - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -188,8 +185,6 @@ async def test_homekit_discovery( assert result["description_placeholders"] == {CONF_NAME: NAME_ROKUTV} with patch( - "homeassistant.components.roku.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.roku.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -205,7 +200,6 @@ async def test_homekit_discovery( assert result["data"][CONF_HOST] == HOMEKIT_HOST assert result["data"][CONF_NAME] == NAME_ROKUTV - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 # test abort on existing host @@ -270,8 +264,6 @@ async def test_ssdp_discovery( assert result["description_placeholders"] == {CONF_NAME: UPNP_FRIENDLY_NAME} with patch( - "homeassistant.components.roku.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.roku.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -287,5 +279,4 @@ async def test_ssdp_discovery( assert result["data"][CONF_HOST] == HOST assert result["data"][CONF_NAME] == UPNP_FRIENDLY_NAME - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/sentry/test_config_flow.py b/tests/components/sentry/test_config_flow.py index 82a1a70ec8b..259d8c65e16 100644 --- a/tests/components/sentry/test_config_flow.py +++ b/tests/components/sentry/test_config_flow.py @@ -32,8 +32,6 @@ async def test_full_user_flow_implementation(hass): assert result["errors"] == {} with patch("homeassistant.components.sentry.config_flow.Dsn"), patch( - "homeassistant.components.sentry.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.sentry.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -49,7 +47,6 @@ async def test_full_user_flow_implementation(hass): } await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/smhi/test_init.py b/tests/components/smhi/test_init.py index 450ac7e6ef0..297a6f587d8 100644 --- a/tests/components/smhi/test_init.py +++ b/tests/components/smhi/test_init.py @@ -14,16 +14,6 @@ TEST_CONFIG = { } -async def test_setup_always_return_true() -> None: - """Test async_setup always returns True.""" - hass = Mock() - # Returns true with empty config - assert await smhi.async_setup(hass, {}) is True - - # Returns true with a config provided - assert await smhi.async_setup(hass, TEST_CONFIG) is True - - async def test_forward_async_setup_entry() -> None: """Test that it will forward setup entry.""" hass = Mock() diff --git a/tests/components/solarlog/test_config_flow.py b/tests/components/solarlog/test_config_flow.py index 3016a73f1b8..d3ba3c3c84a 100644 --- a/tests/components/solarlog/test_config_flow.py +++ b/tests/components/solarlog/test_config_flow.py @@ -27,8 +27,6 @@ async def test_form(hass): "homeassistant.components.solarlog.config_flow.SolarLogConfigFlow._test_connection", return_value={"title": "solarlog test 1 2 3"}, ), patch( - "homeassistant.components.solarlog.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.solarlog.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -40,7 +38,6 @@ async def test_form(hass): assert result2["type"] == "create_entry" assert result2["title"] == "solarlog_test_1_2_3" assert result2["data"] == {"host": "http://1.1.1.1"} - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1