diff --git a/homeassistant/components/flick_electric/__init__.py b/homeassistant/components/flick_electric/__init__.py index 86af47a88bb..04d7b88f52b 100644 --- a/homeassistant/components/flick_electric/__init__.py +++ b/homeassistant/components/flick_electric/__init__.py @@ -22,16 +22,11 @@ from .const import CONF_TOKEN_EXPIRES_IN, CONF_TOKEN_EXPIRY, DOMAIN CONF_ID_TOKEN = "id_token" -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Flick Electric component.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Flick Electric from a config entry.""" auth = HassFlickAuth(hass, entry) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = FlickAPI(auth) hass.async_create_task( diff --git a/homeassistant/components/flo/__init__.py b/homeassistant/components/flo/__init__.py index 71f8a8bfe5c..4ea6d1dec93 100644 --- a/homeassistant/components/flo/__init__.py +++ b/homeassistant/components/flo/__init__.py @@ -19,15 +19,10 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["binary_sensor", "sensor", "switch"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the flo component.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up flo from a config entry.""" session = async_get_clientsession(hass) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = {} try: hass.data[DOMAIN][entry.entry_id][CLIENT] = client = await async_get_api( diff --git a/homeassistant/components/harmony/__init__.py b/homeassistant/components/harmony/__init__.py index c4056044ca0..c273d087580 100644 --- a/homeassistant/components/harmony/__init__.py +++ b/homeassistant/components/harmony/__init__.py @@ -16,13 +16,6 @@ from .data import HarmonyData _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Logitech Harmony Hub component.""" - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Logitech Harmony Hub from a config entry.""" # As there currently is no way to import options from yaml @@ -42,6 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): if not connected_ok: raise ConfigEntryNotReady + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = data await _migrate_old_unique_ids(hass, entry.entry_id, data) diff --git a/homeassistant/components/hunterdouglas_powerview/__init__.py b/homeassistant/components/hunterdouglas_powerview/__init__.py index 2a5c5061cae..2c606dda9f2 100644 --- a/homeassistant/components/hunterdouglas_powerview/__init__.py +++ b/homeassistant/components/hunterdouglas_powerview/__init__.py @@ -63,12 +63,6 @@ PLATFORMS = ["cover", "scene", "sensor"] _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, hass_config: dict): - """Set up the Hunter Douglas PowerView component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Hunter Douglas PowerView from a config entry.""" @@ -122,6 +116,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): update_interval=timedelta(seconds=60), ) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { PV_API: pv_request, PV_ROOM_DATA: room_data, diff --git a/homeassistant/components/ipp/__init__.py b/homeassistant/components/ipp/__init__.py index 86bde4bba6c..95a222ecfe4 100644 --- a/homeassistant/components/ipp/__init__.py +++ b/homeassistant/components/ipp/__init__.py @@ -40,15 +40,9 @@ SCAN_INTERVAL = timedelta(seconds=60) _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, config: dict) -> bool: - """Set up the IPP component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up IPP from a config entry.""" - + hass.data.setdefault(DOMAIN, {}) coordinator = hass.data[DOMAIN].get(entry.entry_id) if not coordinator: # Create IPP instance for this entry diff --git a/homeassistant/components/litterrobot/__init__.py b/homeassistant/components/litterrobot/__init__.py index 6fea013f54c..83bf9f785a2 100644 --- a/homeassistant/components/litterrobot/__init__.py +++ b/homeassistant/components/litterrobot/__init__.py @@ -13,15 +13,9 @@ from .hub import LitterRobotHub PLATFORMS = ["sensor", "switch", "vacuum"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Litter-Robot component.""" - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Litter-Robot from a config entry.""" + hass.data.setdefault(DOMAIN, {}) hub = hass.data[DOMAIN][entry.entry_id] = LitterRobotHub(hass, entry.data) try: await hub.login(load_robots=True) diff --git a/homeassistant/components/mazda/__init__.py b/homeassistant/components/mazda/__init__.py index 2f4e0e84f13..555cc9f3a00 100644 --- a/homeassistant/components/mazda/__init__.py +++ b/homeassistant/components/mazda/__init__.py @@ -38,12 +38,6 @@ async def with_timeout(task, timeout_seconds=10): return await task -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Mazda Connected Services component.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Mazda Connected Services from a config entry.""" email = entry.data[CONF_EMAIL] @@ -111,6 +105,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): update_interval=timedelta(seconds=60), ) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { DATA_CLIENT: mazda_client, DATA_COORDINATOR: coordinator, diff --git a/homeassistant/components/metoffice/__init__.py b/homeassistant/components/metoffice/__init__.py index 87a5488fe01..5dfeceb79f8 100644 --- a/homeassistant/components/metoffice/__init__.py +++ b/homeassistant/components/metoffice/__init__.py @@ -23,11 +23,6 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["sensor", "weather"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Met Office weather component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up a Met Office entry.""" diff --git a/homeassistant/components/minecraft_server/__init__.py b/homeassistant/components/minecraft_server/__init__.py index f76e8e8467e..f466988cda4 100644 --- a/homeassistant/components/minecraft_server/__init__.py +++ b/homeassistant/components/minecraft_server/__init__.py @@ -27,11 +27,6 @@ PLATFORMS = ["binary_sensor", "sensor"] _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: - """Set up the Minecraft Server component.""" - return True - - async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool: """Set up Minecraft Server from a config entry.""" domain_data = hass.data.setdefault(DOMAIN, {}) diff --git a/homeassistant/components/monoprice/__init__.py b/homeassistant/components/monoprice/__init__.py index adc0b05bab7..61aa8b408cf 100644 --- a/homeassistant/components/monoprice/__init__.py +++ b/homeassistant/components/monoprice/__init__.py @@ -23,11 +23,6 @@ PLATFORMS = ["media_player"] _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Monoprice 6-Zone Amplifier component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Monoprice 6-Zone Amplifier from a config entry.""" port = entry.data[CONF_PORT] diff --git a/homeassistant/components/nexia/__init__.py b/homeassistant/components/nexia/__init__.py index 4dde2084400..07f6230eb0d 100644 --- a/homeassistant/components/nexia/__init__.py +++ b/homeassistant/components/nexia/__init__.py @@ -24,14 +24,6 @@ CONFIG_SCHEMA = cv.deprecated(DOMAIN) DEFAULT_UPDATE_RATE = 120 -async def async_setup(hass: HomeAssistant, config: dict) -> bool: - """Set up the nexia component from YAML.""" - - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Configure the base Nexia device for Home Assistant.""" @@ -75,6 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE), ) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { NEXIA_DEVICE: nexia_home, UPDATE_COORDINATOR: coordinator, diff --git a/homeassistant/components/nuheat/__init__.py b/homeassistant/components/nuheat/__init__.py index 9fe4764e1af..c04bfe64720 100644 --- a/homeassistant/components/nuheat/__init__.py +++ b/homeassistant/components/nuheat/__init__.py @@ -25,12 +25,6 @@ _LOGGER = logging.getLogger(__name__) CONFIG_SCHEMA = cv.deprecated(DOMAIN) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the NuHeat component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - def _get_thermostat(api, serial_number): """Authenticate and create the thermostat object.""" api.authenticate() @@ -78,6 +72,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): update_interval=timedelta(minutes=5), ) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = (thermostat, coordinator) for platform in PLATFORMS: diff --git a/homeassistant/components/rpi_power/__init__.py b/homeassistant/components/rpi_power/__init__.py index 993d0b313c0..3f9a9d6e74c 100644 --- a/homeassistant/components/rpi_power/__init__.py +++ b/homeassistant/components/rpi_power/__init__.py @@ -3,11 +3,6 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Raspberry Pi Power Supply Checker component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Raspberry Pi Power Supply Checker from a config entry.""" hass.async_create_task( diff --git a/homeassistant/components/ruckus_unleashed/__init__.py b/homeassistant/components/ruckus_unleashed/__init__.py index 2eb4f143131..78d15f24a63 100644 --- a/homeassistant/components/ruckus_unleashed/__init__.py +++ b/homeassistant/components/ruckus_unleashed/__init__.py @@ -27,12 +27,6 @@ from .const import ( from .coordinator import RuckusUnleashedDataUpdateCoordinator -async def async_setup(hass: HomeAssistant, entry: ConfigEntry) -> bool: - """Set up the Ruckus Unleashed component.""" - hass.data[DOMAIN] = {} - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Ruckus Unleashed from a config entry.""" try: @@ -64,6 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: sw_version=system_info[API_SYSTEM_OVERVIEW][API_VERSION], ) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { COORDINATOR: coordinator, UNDO_UPDATE_LISTENERS: [], diff --git a/homeassistant/components/smart_meter_texas/__init__.py b/homeassistant/components/smart_meter_texas/__init__.py index 3180248fcd1..71504fb52aa 100644 --- a/homeassistant/components/smart_meter_texas/__init__.py +++ b/homeassistant/components/smart_meter_texas/__init__.py @@ -32,12 +32,6 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["sensor"] -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Smart Meter Texas component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Smart Meter Texas from a config entry.""" @@ -76,6 +70,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): ), ) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { DATA_COORDINATOR: coordinator, DATA_SMART_METER: smart_meter_texas_data, diff --git a/homeassistant/components/smarttub/__init__.py b/homeassistant/components/smarttub/__init__.py index 457af4b7bc0..c907bfdeae3 100644 --- a/homeassistant/components/smarttub/__init__.py +++ b/homeassistant/components/smarttub/__init__.py @@ -10,18 +10,11 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["binary_sensor", "climate", "light", "sensor", "switch"] -async def async_setup(hass, config): - """Set up smarttub component.""" - - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass, entry): """Set up a smarttub config entry.""" controller = SmartTubController(hass) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { SMARTTUB_CONTROLLER: controller, } diff --git a/homeassistant/components/sonarr/__init__.py b/homeassistant/components/sonarr/__init__.py index 81053922034..ad5b0299f3e 100644 --- a/homeassistant/components/sonarr/__init__.py +++ b/homeassistant/components/sonarr/__init__.py @@ -41,12 +41,6 @@ SCAN_INTERVAL = timedelta(seconds=30) _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistantType, config: dict) -> bool: - """Set up the Sonarr component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up Sonarr from a config entry.""" if not entry.options: @@ -81,6 +75,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool undo_listener = entry.add_update_listener(_async_update_listener) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { DATA_SONARR: sonarr, DATA_UNDO_UPDATE_LISTENER: undo_listener, diff --git a/homeassistant/components/tado/__init__.py b/homeassistant/components/tado/__init__.py index 094465d38aa..5a396bedcf2 100644 --- a/homeassistant/components/tado/__init__.py +++ b/homeassistant/components/tado/__init__.py @@ -39,14 +39,6 @@ SCAN_INTERVAL = timedelta(minutes=5) CONFIG_SCHEMA = cv.deprecated(DOMAIN) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the Tado component.""" - - hass.data.setdefault(DOMAIN, {}) - - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Tado from a config entry.""" @@ -86,6 +78,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): update_listener = entry.add_update_listener(_async_update_listener) + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = { DATA: tadoconnector, UPDATE_TRACK: update_track, diff --git a/homeassistant/components/vilfo/__init__.py b/homeassistant/components/vilfo/__init__.py index ffa628d6db2..16488269da6 100644 --- a/homeassistant/components/vilfo/__init__.py +++ b/homeassistant/components/vilfo/__init__.py @@ -10,7 +10,6 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady -from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.util import Throttle from .const import ATTR_BOOT_TIME, ATTR_LOAD, DOMAIN, ROUTER_DEFAULT_HOST @@ -22,12 +21,6 @@ DEFAULT_SCAN_INTERVAL = timedelta(seconds=30) _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistantType, config: ConfigType): - """Set up the Vilfo Router component.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Vilfo Router from a config entry.""" host = entry.data[CONF_HOST] @@ -40,6 +33,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): if not vilfo_router.available: raise ConfigEntryNotReady + hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN][entry.entry_id] = vilfo_router for platform in PLATFORMS: diff --git a/homeassistant/components/xiaomi_miio/__init__.py b/homeassistant/components/xiaomi_miio/__init__.py index f97d4623d69..fa2dfcb9944 100644 --- a/homeassistant/components/xiaomi_miio/__init__.py +++ b/homeassistant/components/xiaomi_miio/__init__.py @@ -35,11 +35,6 @@ VACUUM_PLATFORMS = ["vacuum"] AIR_MONITOR_PLATFORMS = ["air_quality", "sensor"] -async def async_setup(hass: core.HomeAssistant, config: dict): - """Set up the Xiaomi Miio component.""" - return True - - async def async_setup_entry( hass: core.HomeAssistant, entry: config_entries.ConfigEntry ): diff --git a/tests/components/flick_electric/test_config_flow.py b/tests/components/flick_electric/test_config_flow.py index 1890ea9448a..580db390afb 100644 --- a/tests/components/flick_electric/test_config_flow.py +++ b/tests/components/flick_electric/test_config_flow.py @@ -34,8 +34,6 @@ async def test_form(hass): "homeassistant.components.flick_electric.config_flow.SimpleFlickAuth.async_get_access_token", return_value="123456789abcdef", ), patch( - "homeassistant.components.flick_electric.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.flick_electric.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -48,7 +46,6 @@ async def test_form(hass): assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == "Flick Electric: test-username" assert result2["data"] == CONF - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/flo/test_config_flow.py b/tests/components/flo/test_config_flow.py index d26051bbcb2..3fd68979b05 100644 --- a/tests/components/flo/test_config_flow.py +++ b/tests/components/flo/test_config_flow.py @@ -20,8 +20,6 @@ async def test_form(hass, aioclient_mock_fixture): assert result["errors"] == {} with patch( - "homeassistant.components.flo.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.flo.async_setup_entry", return_value=True ) as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( @@ -32,7 +30,6 @@ async def test_form(hass, aioclient_mock_fixture): assert result2["title"] == "Home" assert result2["data"] == {"username": TEST_USER_ID, "password": TEST_PASSWORD} 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/harmony/test_config_flow.py b/tests/components/harmony/test_config_flow.py index 7f651890868..d81adabb916 100644 --- a/tests/components/harmony/test_config_flow.py +++ b/tests/components/harmony/test_config_flow.py @@ -31,8 +31,6 @@ async def test_user_form(hass): "homeassistant.components.harmony.util.HarmonyAPI", return_value=harmonyapi, ), patch( - "homeassistant.components.harmony.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.harmony.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -45,7 +43,6 @@ async def test_user_form(hass): assert result2["type"] == "create_entry" assert result2["title"] == "friend" assert result2["data"] == {"host": "1.2.3.4", "name": "friend"} - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -83,8 +80,6 @@ async def test_form_ssdp(hass): "homeassistant.components.harmony.util.HarmonyAPI", return_value=harmonyapi, ), patch( - "homeassistant.components.harmony.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.harmony.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -97,7 +92,6 @@ async def test_form_ssdp(hass): assert result2["type"] == "create_entry" assert result2["title"] == "Harmony Hub" assert result2["data"] == {"host": "192.168.1.12", "name": "Harmony Hub"} - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/hunterdouglas_powerview/test_config_flow.py b/tests/components/hunterdouglas_powerview/test_config_flow.py index b5b9ee84f27..442cd42f0bc 100644 --- a/tests/components/hunterdouglas_powerview/test_config_flow.py +++ b/tests/components/hunterdouglas_powerview/test_config_flow.py @@ -36,9 +36,6 @@ async def test_user_form(hass): "homeassistant.components.hunterdouglas_powerview.UserData", return_value=mock_powerview_userdata, ), patch( - "homeassistant.components.hunterdouglas_powerview.async_setup", - return_value=True, - ) as mock_setup, patch( "homeassistant.components.hunterdouglas_powerview.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -53,7 +50,6 @@ async def test_user_form(hass): assert result2["data"] == { "host": "1.2.3.4", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 result3 = await hass.config_entries.flow.async_init( @@ -103,9 +99,6 @@ async def test_form_homekit(hass): "homeassistant.components.hunterdouglas_powerview.UserData", return_value=mock_powerview_userdata, ), patch( - "homeassistant.components.hunterdouglas_powerview.async_setup", - return_value=True, - ) as mock_setup, patch( "homeassistant.components.hunterdouglas_powerview.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -117,7 +110,6 @@ async def test_form_homekit(hass): assert result2["data"] == {"host": "1.2.3.4"} assert result2["result"].unique_id == "ABC123" - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 result3 = await hass.config_entries.flow.async_init( diff --git a/tests/components/ipp/test_config_flow.py b/tests/components/ipp/test_config_flow.py index 140570c3c54..23670ff0d1a 100644 --- a/tests/components/ipp/test_config_flow.py +++ b/tests/components/ipp/test_config_flow.py @@ -344,9 +344,7 @@ async def test_full_user_flow_implementation( assert result["step_id"] == "user" assert result["type"] == RESULT_TYPE_FORM - with patch( - "homeassistant.components.ipp.async_setup_entry", return_value=True - ), patch("homeassistant.components.ipp.async_setup", return_value=True): + with patch("homeassistant.components.ipp.async_setup_entry", return_value=True): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"}, @@ -379,9 +377,7 @@ async def test_full_zeroconf_flow_implementation( assert result["step_id"] == "zeroconf_confirm" assert result["type"] == RESULT_TYPE_FORM - with patch( - "homeassistant.components.ipp.async_setup_entry", return_value=True - ), patch("homeassistant.components.ipp.async_setup", return_value=True): + with patch("homeassistant.components.ipp.async_setup_entry", return_value=True): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) @@ -416,9 +412,7 @@ async def test_full_zeroconf_tls_flow_implementation( assert result["type"] == RESULT_TYPE_FORM assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"} - with patch( - "homeassistant.components.ipp.async_setup_entry", return_value=True - ), patch("homeassistant.components.ipp.async_setup", return_value=True): + with patch("homeassistant.components.ipp.async_setup_entry", return_value=True): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input={} ) diff --git a/tests/components/litterrobot/test_config_flow.py b/tests/components/litterrobot/test_config_flow.py index 33b22b6a1bd..8d39f7ac9e8 100644 --- a/tests/components/litterrobot/test_config_flow.py +++ b/tests/components/litterrobot/test_config_flow.py @@ -24,8 +24,6 @@ async def test_form(hass, mock_account): "homeassistant.components.litterrobot.hub.Account", return_value=mock_account, ), patch( - "homeassistant.components.litterrobot.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.litterrobot.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -37,7 +35,6 @@ async def test_form(hass, mock_account): assert result2["type"] == "create_entry" assert result2["title"] == CONFIG[DOMAIN][CONF_USERNAME] assert result2["data"] == CONFIG[DOMAIN] - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/mazda/test_config_flow.py b/tests/components/mazda/test_config_flow.py index fbdd74bfdfa..f4bdfa930bd 100644 --- a/tests/components/mazda/test_config_flow.py +++ b/tests/components/mazda/test_config_flow.py @@ -39,8 +39,6 @@ async def test_form(hass): "homeassistant.components.mazda.config_flow.MazdaAPI.validate_credentials", return_value=True, ), patch( - "homeassistant.components.mazda.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.mazda.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -53,7 +51,6 @@ async def test_form(hass): assert result2["type"] == "create_entry" assert result2["title"] == FIXTURE_USER_INPUT[CONF_EMAIL] assert result2["data"] == FIXTURE_USER_INPUT - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/metoffice/test_config_flow.py b/tests/components/metoffice/test_config_flow.py index f0023b0d8d5..8f01f4b9643 100644 --- a/tests/components/metoffice/test_config_flow.py +++ b/tests/components/metoffice/test_config_flow.py @@ -34,8 +34,6 @@ async def test_form(hass, requests_mock): assert result["errors"] == {} with patch( - "homeassistant.components.metoffice.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.metoffice.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -52,7 +50,6 @@ async def test_form(hass, requests_mock): "longitude": TEST_LONGITUDE_WAVERTREE, "name": TEST_SITE_NAME_WAVERTREE, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/monoprice/test_config_flow.py b/tests/components/monoprice/test_config_flow.py index 0b954cb6e34..3e133519d1b 100644 --- a/tests/components/monoprice/test_config_flow.py +++ b/tests/components/monoprice/test_config_flow.py @@ -36,8 +36,6 @@ async def test_form(hass): "homeassistant.components.monoprice.config_flow.get_async_monoprice", return_value=True, ), patch( - "homeassistant.components.monoprice.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.monoprice.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -52,7 +50,6 @@ async def test_form(hass): CONF_PORT: CONFIG[CONF_PORT], CONF_SOURCES: {"1": CONFIG[CONF_SOURCE_1], "4": CONFIG[CONF_SOURCE_4]}, } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nexia/test_config_flow.py b/tests/components/nexia/test_config_flow.py index 42917e77cfe..b9726fdd974 100644 --- a/tests/components/nexia/test_config_flow.py +++ b/tests/components/nexia/test_config_flow.py @@ -24,8 +24,6 @@ async def test_form(hass): "homeassistant.components.nexia.config_flow.NexiaHome.login", side_effect=MagicMock(), ), patch( - "homeassistant.components.nexia.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nexia.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -41,7 +39,6 @@ async def test_form(hass): CONF_USERNAME: "username", CONF_PASSWORD: "password", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/nuheat/test_config_flow.py b/tests/components/nuheat/test_config_flow.py index a21e2e744de..525ab18726a 100644 --- a/tests/components/nuheat/test_config_flow.py +++ b/tests/components/nuheat/test_config_flow.py @@ -28,8 +28,6 @@ async def test_form_user(hass): "homeassistant.components.nuheat.config_flow.nuheat.NuHeat.get_thermostat", return_value=mock_thermostat, ), patch( - "homeassistant.components.nuheat.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.nuheat.async_setup_entry", return_value=True ) as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( @@ -49,7 +47,6 @@ async def test_form_user(hass): CONF_USERNAME: "test-username", CONF_PASSWORD: "test-password", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/ruckus_unleashed/test_config_flow.py b/tests/components/ruckus_unleashed/test_config_flow.py index a11943bff00..9a93dcf78a7 100644 --- a/tests/components/ruckus_unleashed/test_config_flow.py +++ b/tests/components/ruckus_unleashed/test_config_flow.py @@ -30,8 +30,6 @@ async def test_form(hass): "homeassistant.components.ruckus_unleashed.Ruckus.system_info", return_value=DEFAULT_SYSTEM_INFO, ), patch( - "homeassistant.components.ruckus_unleashed.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.ruckus_unleashed.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -44,7 +42,6 @@ async def test_form(hass): assert result2["type"] == "create_entry" assert result2["title"] == DEFAULT_TITLE assert result2["data"] == CONFIG - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/smart_meter_texas/test_config_flow.py b/tests/components/smart_meter_texas/test_config_flow.py index d0108f2ee09..246ae4edc7d 100644 --- a/tests/components/smart_meter_texas/test_config_flow.py +++ b/tests/components/smart_meter_texas/test_config_flow.py @@ -28,8 +28,6 @@ async def test_form(hass): assert result["errors"] == {} with patch("smart_meter_texas.Client.authenticate", return_value=True), patch( - "homeassistant.components.smart_meter_texas.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.smart_meter_texas.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -41,7 +39,6 @@ async def test_form(hass): assert result2["type"] == "create_entry" assert result2["title"] == TEST_LOGIN[CONF_USERNAME] assert result2["data"] == TEST_LOGIN - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/smarttub/test_config_flow.py b/tests/components/smarttub/test_config_flow.py index 2608d867c0d..8e4d575119e 100644 --- a/tests/components/smarttub/test_config_flow.py +++ b/tests/components/smarttub/test_config_flow.py @@ -16,8 +16,6 @@ async def test_form(hass): assert result["errors"] == {} with patch( - "homeassistant.components.smarttub.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.smarttub.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -33,7 +31,6 @@ async def test_form(hass): "password": "test-password", } await hass.async_block_till_done() - mock_setup.assert_called_once() mock_setup_entry.assert_called_once() result = await hass.config_entries.flow.async_init( diff --git a/tests/components/sonarr/__init__.py b/tests/components/sonarr/__init__.py index 1313db4460d..c1d4fc30736 100644 --- a/tests/components/sonarr/__init__.py +++ b/tests/components/sonarr/__init__.py @@ -227,13 +227,6 @@ async def setup_integration( return entry -def _patch_async_setup(return_value=True): - """Patch the async setup of sonarr.""" - return patch( - "homeassistant.components.sonarr.async_setup", return_value=return_value - ) - - def _patch_async_setup_entry(return_value=True): """Patch the async entry setup of sonarr.""" return patch( diff --git a/tests/components/sonarr/test_config_flow.py b/tests/components/sonarr/test_config_flow.py index 5f32e72aee1..71ec1420244 100644 --- a/tests/components/sonarr/test_config_flow.py +++ b/tests/components/sonarr/test_config_flow.py @@ -21,7 +21,6 @@ from tests.components.sonarr import ( HOST, MOCK_REAUTH_INPUT, MOCK_USER_INPUT, - _patch_async_setup, _patch_async_setup_entry, mock_connection, mock_connection_error, @@ -123,7 +122,7 @@ async def test_full_reauth_flow_implementation( assert result["step_id"] == "user" user_input = MOCK_REAUTH_INPUT.copy() - with _patch_async_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_configure( result["flow_id"], user_input=user_input ) @@ -153,7 +152,7 @@ async def test_full_user_flow_implementation( user_input = MOCK_USER_INPUT.copy() - with _patch_async_setup(), _patch_async_setup_entry(): + with _patch_async_setup_entry(): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=user_input, @@ -184,7 +183,7 @@ async def test_full_user_flow_advanced_options( CONF_VERIFY_SSL: True, } - with _patch_async_setup(), _patch_async_setup_entry(): + with _patch_async_setup_entry(): result = await hass.config_entries.flow.async_configure( result["flow_id"], user_input=user_input, @@ -211,7 +210,7 @@ async def test_options_flow(hass, aioclient_mock: AiohttpClientMocker): assert result["type"] == RESULT_TYPE_FORM assert result["step_id"] == "init" - with _patch_async_setup(), _patch_async_setup_entry(): + with _patch_async_setup_entry(): result = await hass.config_entries.options.async_configure( result["flow_id"], user_input={CONF_UPCOMING_DAYS: 2, CONF_WANTED_MAX_ITEMS: 100}, diff --git a/tests/components/tado/test_config_flow.py b/tests/components/tado/test_config_flow.py index c3e2bac68ca..90b7e87504c 100644 --- a/tests/components/tado/test_config_flow.py +++ b/tests/components/tado/test_config_flow.py @@ -34,8 +34,6 @@ async def test_form(hass): "homeassistant.components.tado.config_flow.Tado", return_value=mock_tado_api, ), patch( - "homeassistant.components.tado.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.tado.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -51,7 +49,6 @@ async def test_form(hass): "username": "test-username", "password": "test-password", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/vilfo/test_config_flow.py b/tests/components/vilfo/test_config_flow.py index 6e98ef3fdd9..d828963ba39 100644 --- a/tests/components/vilfo/test_config_flow.py +++ b/tests/components/vilfo/test_config_flow.py @@ -21,8 +21,6 @@ async def test_form(hass): with patch("vilfo.Client.ping", return_value=None), patch( "vilfo.Client.get_board_information", return_value=None ), patch("vilfo.Client.resolve_mac_address", return_value=mock_mac), patch( - "homeassistant.components.vilfo.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.vilfo.async_setup_entry" ) as mock_setup_entry: result2 = await hass.config_entries.flow.async_configure( @@ -38,7 +36,6 @@ async def test_form(hass): "access_token": "test-token", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1