From c68b259bd3e43d77fe9b9d47c768f9aa6198571e Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 29 Apr 2021 23:12:58 +0200 Subject: [PATCH] Cleanup of unused connection_class logic (#49865) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Joakim Sørensen --- .../components/adguard/config_flow.py | 2 -- .../components/config/config_entries.py | 1 - homeassistant/components/gree/config_flow.py | 5 +--- .../components/hisense_aehw4a1/config_flow.py | 3 +-- homeassistant/components/ios/config_flow.py | 5 +--- homeassistant/components/izone/config_flow.py | 5 +--- .../components/kulersky/config_flow.py | 5 +--- homeassistant/components/lifx/config_flow.py | 5 +--- .../components/rpi_power/config_flow.py | 2 -- homeassistant/components/sonos/config_flow.py | 5 +--- .../components/tplink/config_flow.py | 2 -- .../components/verisure/config_flow.py | 8 +----- homeassistant/components/wemo/config_flow.py | 5 +--- .../components/zerproc/config_flow.py | 5 +--- homeassistant/config_entries.py | 9 ------- homeassistant/helpers/config_entry_flow.py | 25 +++++++++++++++---- .../integration/config_flow.py | 5 +--- tests/common.py | 2 -- tests/components/axis/test_device.py | 2 -- .../bmw_connected_drive/test_config_flow.py | 1 - .../cast/test_home_assistant_cast.py | 2 -- .../components/config/test_config_entries.py | 11 +------- tests/components/deconz/test_gateway.py | 3 +-- tests/components/eafm/test_sensor.py | 1 - .../forked_daapd/test_config_flow.py | 7 +----- .../forked_daapd/test_media_player.py | 3 +-- .../components/home_plus_control/conftest.py | 2 -- tests/components/homekit_controller/common.py | 2 -- .../homekit_controller/test_storage.py | 1 - .../components/homematicip_cloud/conftest.py | 1 - tests/components/hue/conftest.py | 2 -- tests/components/hue/test_bridge.py | 4 --- .../hue/test_init_multiple_bridges.py | 2 -- tests/components/hue/test_light.py | 1 - tests/components/huisbaasje/test_init.py | 4 --- tests/components/huisbaasje/test_sensor.py | 3 --- .../hvv_departures/test_config_flow.py | 5 +--- tests/components/mobile_app/test_notify.py | 2 -- tests/components/onewire/__init__.py | 5 +--- tests/components/onewire/test_init.py | 3 --- tests/components/onvif/test_config_flow.py | 1 - tests/components/ozw/common.py | 1 - tests/components/ozw/test_init.py | 7 ------ tests/components/picnic/test_sensor.py | 2 -- tests/components/smartthings/conftest.py | 4 +-- tests/components/srp_energy/__init__.py | 1 - tests/components/tasmota/conftest.py | 2 -- tests/components/unifi/test_device_tracker.py | 1 - tests/components/unifi/test_switch.py | 2 -- tests/components/zwave/test_lock.py | 1 - tests/components/zwave_js/test_init.py | 8 ------ tests/helpers/test_config_entry_flow.py | 13 +++++++++- tests/test_config_entries.py | 3 --- 53 files changed, 50 insertions(+), 162 deletions(-) diff --git a/homeassistant/components/adguard/config_flow.py b/homeassistant/components/adguard/config_flow.py index d8d0b5db6a8..11d97d98d62 100644 --- a/homeassistant/components/adguard/config_flow.py +++ b/homeassistant/components/adguard/config_flow.py @@ -6,7 +6,6 @@ from typing import Any from adguardhome import AdGuardHome, AdGuardHomeConnectionError import voluptuous as vol -from homeassistant import config_entries from homeassistant.config_entries import ConfigFlow from homeassistant.const import ( CONF_HOST, @@ -26,7 +25,6 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN): """Handle a AdGuard Home config flow.""" VERSION = 1 - CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL _hassio_discovery = None diff --git a/homeassistant/components/config/config_entries.py b/homeassistant/components/config/config_entries.py index 264510627e0..11c39089f35 100644 --- a/homeassistant/components/config/config_entries.py +++ b/homeassistant/components/config/config_entries.py @@ -386,7 +386,6 @@ def entry_json(entry: config_entries.ConfigEntry) -> dict: "title": entry.title, "source": entry.source, "state": entry.state, - "connection_class": entry.connection_class, "supports_options": supports_options, "supports_unload": entry.supports_unload, "disabled_by": entry.disabled_by, diff --git a/homeassistant/components/gree/config_flow.py b/homeassistant/components/gree/config_flow.py index cc61eabe12c..bf6fc7cc334 100644 --- a/homeassistant/components/gree/config_flow.py +++ b/homeassistant/components/gree/config_flow.py @@ -1,7 +1,6 @@ """Config flow for Gree.""" from greeclimate.discovery import Discovery -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from .const import DISCOVERY_TIMEOUT, DOMAIN @@ -14,6 +13,4 @@ async def _async_has_devices(hass) -> bool: return len(devices) > 0 -config_entry_flow.register_discovery_flow( - DOMAIN, "Gree Climate", _async_has_devices, config_entries.CONN_CLASS_LOCAL_POLL -) +config_entry_flow.register_discovery_flow(DOMAIN, "Gree Climate", _async_has_devices) diff --git a/homeassistant/components/hisense_aehw4a1/config_flow.py b/homeassistant/components/hisense_aehw4a1/config_flow.py index 326b5c5895d..06eebb45948 100644 --- a/homeassistant/components/hisense_aehw4a1/config_flow.py +++ b/homeassistant/components/hisense_aehw4a1/config_flow.py @@ -1,7 +1,6 @@ """Config flow for Hisense AEH-W4A1 integration.""" from pyaehw4a1.aehw4a1 import AehW4a1 -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from .const import DOMAIN @@ -14,5 +13,5 @@ async def _async_has_devices(hass): config_entry_flow.register_discovery_flow( - DOMAIN, "Hisense AEH-W4A1", _async_has_devices, config_entries.CONN_CLASS_LOCAL_POLL + DOMAIN, "Hisense AEH-W4A1", _async_has_devices ) diff --git a/homeassistant/components/ios/config_flow.py b/homeassistant/components/ios/config_flow.py index 9eaca389ba1..fc15cd833bc 100644 --- a/homeassistant/components/ios/config_flow.py +++ b/homeassistant/components/ios/config_flow.py @@ -1,9 +1,6 @@ """Config flow for iOS.""" -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from .const import DOMAIN -config_entry_flow.register_discovery_flow( - DOMAIN, "Home Assistant iOS", lambda *_: True, config_entries.CONN_CLASS_CLOUD_PUSH -) +config_entry_flow.register_discovery_flow(DOMAIN, "Home Assistant iOS", lambda *_: True) diff --git a/homeassistant/components/izone/config_flow.py b/homeassistant/components/izone/config_flow.py index bb647f6273c..83a77e12579 100644 --- a/homeassistant/components/izone/config_flow.py +++ b/homeassistant/components/izone/config_flow.py @@ -6,7 +6,6 @@ import logging from async_timeout import timeout -from homeassistant import config_entries from homeassistant.core import callback from homeassistant.helpers import config_entry_flow from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -42,6 +41,4 @@ async def _async_has_devices(hass): return True -config_entry_flow.register_discovery_flow( - IZONE, "iZone Aircon", _async_has_devices, config_entries.CONN_CLASS_LOCAL_POLL -) +config_entry_flow.register_discovery_flow(IZONE, "iZone Aircon", _async_has_devices) diff --git a/homeassistant/components/kulersky/config_flow.py b/homeassistant/components/kulersky/config_flow.py index 2a11a3c2e17..f56688e919a 100644 --- a/homeassistant/components/kulersky/config_flow.py +++ b/homeassistant/components/kulersky/config_flow.py @@ -3,7 +3,6 @@ import logging import pykulersky -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from .const import DOMAIN @@ -22,6 +21,4 @@ async def _async_has_devices(hass) -> bool: return len(devices) > 0 -config_entry_flow.register_discovery_flow( - DOMAIN, "Kuler Sky", _async_has_devices, config_entries.CONN_CLASS_LOCAL_POLL -) +config_entry_flow.register_discovery_flow(DOMAIN, "Kuler Sky", _async_has_devices) diff --git a/homeassistant/components/lifx/config_flow.py b/homeassistant/components/lifx/config_flow.py index 71fe7247c12..1713683b720 100644 --- a/homeassistant/components/lifx/config_flow.py +++ b/homeassistant/components/lifx/config_flow.py @@ -1,7 +1,6 @@ """Config flow flow LIFX.""" import aiolifx -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from .const import DOMAIN @@ -13,6 +12,4 @@ async def _async_has_devices(hass): return len(lifx_ip_addresses) > 0 -config_entry_flow.register_discovery_flow( - DOMAIN, "LIFX", _async_has_devices, config_entries.CONN_CLASS_LOCAL_POLL -) +config_entry_flow.register_discovery_flow(DOMAIN, "LIFX", _async_has_devices) diff --git a/homeassistant/components/rpi_power/config_flow.py b/homeassistant/components/rpi_power/config_flow.py index 1994aeb7b97..1a038d05fdc 100644 --- a/homeassistant/components/rpi_power/config_flow.py +++ b/homeassistant/components/rpi_power/config_flow.py @@ -5,7 +5,6 @@ from typing import Any from rpi_bad_power import new_under_voltage -from homeassistant import config_entries from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers.config_entry_flow import DiscoveryFlowHandler @@ -30,7 +29,6 @@ class RPiPowerFlow(DiscoveryFlowHandler, domain=DOMAIN): DOMAIN, "Raspberry Pi Power Supply Checker", _async_supported, - config_entries.CONN_CLASS_LOCAL_POLL, ) async def async_step_onboarding( diff --git a/homeassistant/components/sonos/config_flow.py b/homeassistant/components/sonos/config_flow.py index 6807cffa373..5037abb79aa 100644 --- a/homeassistant/components/sonos/config_flow.py +++ b/homeassistant/components/sonos/config_flow.py @@ -1,7 +1,6 @@ """Config flow for SONOS.""" import pysonos -from homeassistant import config_entries from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow @@ -14,6 +13,4 @@ async def _async_has_devices(hass: HomeAssistant) -> bool: return bool(result) -config_entry_flow.register_discovery_flow( - DOMAIN, "Sonos", _async_has_devices, config_entries.CONN_CLASS_LOCAL_PUSH -) +config_entry_flow.register_discovery_flow(DOMAIN, "Sonos", _async_has_devices) diff --git a/homeassistant/components/tplink/config_flow.py b/homeassistant/components/tplink/config_flow.py index 40583294bfd..033d80cf407 100644 --- a/homeassistant/components/tplink/config_flow.py +++ b/homeassistant/components/tplink/config_flow.py @@ -1,5 +1,4 @@ """Config flow for TP-Link.""" -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from .common import async_get_discoverable_devices @@ -9,5 +8,4 @@ config_entry_flow.register_discovery_flow( DOMAIN, "TP-Link Smart Home", async_get_discoverable_devices, - config_entries.CONN_CLASS_LOCAL_POLL, ) diff --git a/homeassistant/components/verisure/config_flow.py b/homeassistant/components/verisure/config_flow.py index 2c472212bda..34238d0763d 100644 --- a/homeassistant/components/verisure/config_flow.py +++ b/homeassistant/components/verisure/config_flow.py @@ -11,12 +11,7 @@ from verisure import ( ) import voluptuous as vol -from homeassistant.config_entries import ( - CONN_CLASS_CLOUD_POLL, - ConfigEntry, - ConfigFlow, - OptionsFlow, -) +from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.core import callback from homeassistant.data_entry_flow import FlowResult @@ -35,7 +30,6 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN): """Handle a config flow for Verisure.""" VERSION = 1 - CONNECTION_CLASS = CONN_CLASS_CLOUD_POLL email: str entry: ConfigEntry diff --git a/homeassistant/components/wemo/config_flow.py b/homeassistant/components/wemo/config_flow.py index 9ad7dda10ba..b778779ea3c 100644 --- a/homeassistant/components/wemo/config_flow.py +++ b/homeassistant/components/wemo/config_flow.py @@ -2,7 +2,6 @@ import pywemo -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from . import DOMAIN @@ -13,6 +12,4 @@ async def _async_has_devices(hass): return bool(await hass.async_add_executor_job(pywemo.discover_devices)) -config_entry_flow.register_discovery_flow( - DOMAIN, "Wemo", _async_has_devices, config_entries.CONN_CLASS_LOCAL_PUSH -) +config_entry_flow.register_discovery_flow(DOMAIN, "Wemo", _async_has_devices) diff --git a/homeassistant/components/zerproc/config_flow.py b/homeassistant/components/zerproc/config_flow.py index 6e3d70b0815..fdf17c14e5a 100644 --- a/homeassistant/components/zerproc/config_flow.py +++ b/homeassistant/components/zerproc/config_flow.py @@ -3,7 +3,6 @@ import logging import pyzerproc -from homeassistant import config_entries from homeassistant.helpers import config_entry_flow from .const import DOMAIN @@ -21,6 +20,4 @@ async def _async_has_devices(hass) -> bool: return False -config_entry_flow.register_discovery_flow( - DOMAIN, "Zerproc", _async_has_devices, config_entries.CONN_CLASS_LOCAL_POLL -) +config_entry_flow.register_discovery_flow(DOMAIN, "Zerproc", _async_has_devices) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 09325b118bf..76e523a6d89 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -133,7 +133,6 @@ class ConfigEntry: "supports_unload", "system_options", "source", - "connection_class", "state", "disabled_by", "_setup_lock", @@ -150,7 +149,6 @@ class ConfigEntry: title: str, data: Mapping[str, Any], source: str, - connection_class: str, system_options: dict, options: dict | None = None, unique_id: str | None = None, @@ -183,9 +181,6 @@ class ConfigEntry: # Source of the configuration (user, discovery, cloud) self.source = source - # Connection class - self.connection_class = connection_class - # State of the entry (LOADED, NOT_LOADED) self.state = state @@ -521,7 +516,6 @@ class ConfigEntry: "options": dict(self.options), "system_options": self.system_options.as_dict(), "source": self.source, - "connection_class": self.connection_class, "unique_id": self.unique_id, "disabled_by": self.disabled_by, } @@ -637,7 +631,6 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager): options={}, system_options={}, source=flow.context["source"], - connection_class=flow.CONNECTION_CLASS, unique_id=flow.unique_id, ) @@ -837,8 +830,6 @@ class ConfigEntries: data=entry["data"], source=entry["source"], title=entry["title"], - # New in 0.79 - connection_class=entry.get("connection_class", CONN_CLASS_UNKNOWN), # New in 0.89 options=entry.get("options"), # New in 0.98 diff --git a/homeassistant/helpers/config_entry_flow.py b/homeassistant/helpers/config_entry_flow.py index 4020c9bb44c..1a29f8a1752 100644 --- a/homeassistant/helpers/config_entry_flow.py +++ b/homeassistant/helpers/config_entry_flow.py @@ -1,15 +1,18 @@ """Helpers for data entry flows for config entries.""" from __future__ import annotations +import logging from typing import Any, Awaitable, Callable, Union from homeassistant import config_entries from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResult -from homeassistant.helpers.typing import DiscoveryInfoType +from homeassistant.helpers.typing import UNDEFINED, DiscoveryInfoType, UndefinedType DiscoveryFunctionType = Callable[[], Union[Awaitable[bool], bool]] +_LOGGER = logging.getLogger(__name__) + class DiscoveryFlowHandler(config_entries.ConfigFlow): """Handle a discovery config flow.""" @@ -21,13 +24,11 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow): domain: str, title: str, discovery_function: DiscoveryFunctionType, - connection_class: str, ) -> None: """Initialize the discovery config flow.""" self._domain = domain self._title = title self._discovery_function = discovery_function - self.CONNECTION_CLASS = connection_class # pylint: disable=invalid-name async def async_step_user( self, user_input: dict[str, Any] | None = None @@ -104,15 +105,29 @@ def register_discovery_flow( domain: str, title: str, discovery_function: DiscoveryFunctionType, - connection_class: str, + connection_class: str | UndefinedType = UNDEFINED, ) -> None: """Register flow for discovered integrations that not require auth.""" + if connection_class is not UNDEFINED: + _LOGGER.warning( + ( + "The %s (%s) integration is setting a connection_class" + " when calling the 'register_discovery_flow()' method in its" + " config flow. The connection class has been deprecated and will" + " be removed in a future release of Home Assistant." + " If '%s' is a custom integration, please contact the author" + " of that integration about this warning.", + ), + title, + domain, + domain, + ) class DiscoveryFlow(DiscoveryFlowHandler): """Discovery flow handler.""" def __init__(self) -> None: - super().__init__(domain, title, discovery_function, connection_class) + super().__init__(domain, title, discovery_function) config_entries.HANDLERS.register(domain)(DiscoveryFlow) diff --git a/script/scaffold/templates/config_flow_discovery/integration/config_flow.py b/script/scaffold/templates/config_flow_discovery/integration/config_flow.py index 4d2ee2c9f6b..4e1b70a51f3 100644 --- a/script/scaffold/templates/config_flow_discovery/integration/config_flow.py +++ b/script/scaffold/templates/config_flow_discovery/integration/config_flow.py @@ -1,7 +1,6 @@ """Config flow for NEW_NAME.""" import my_pypi_dependency -from homeassistant import config_entries from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow @@ -15,6 +14,4 @@ async def _async_has_devices(hass: HomeAssistant) -> bool: return len(devices) > 0 -config_entry_flow.register_discovery_flow( - DOMAIN, "NEW_NAME", _async_has_devices, config_entries.CONN_CLASS_UNKNOWN -) +config_entry_flow.register_discovery_flow(DOMAIN, "NEW_NAME", _async_has_devices) diff --git a/tests/common.py b/tests/common.py index d63e3859108..ee969f7ca11 100644 --- a/tests/common.py +++ b/tests/common.py @@ -731,7 +731,6 @@ class MockConfigEntry(config_entries.ConfigEntry): state=None, options={}, system_options={}, - connection_class=config_entries.CONN_CLASS_UNKNOWN, unique_id=None, disabled_by=None, reason=None, @@ -745,7 +744,6 @@ class MockConfigEntry(config_entries.ConfigEntry): "options": options, "version": version, "title": title, - "connection_class": connection_class, "unique_id": unique_id, "disabled_by": disabled_by, } diff --git a/tests/components/axis/test_device.py b/tests/components/axis/test_device.py index cb6e5b1a12b..a68fa50a093 100644 --- a/tests/components/axis/test_device.py +++ b/tests/components/axis/test_device.py @@ -8,7 +8,6 @@ from axis.event_stream import OPERATION_INITIALIZED import pytest import respx -from homeassistant import config_entries from homeassistant.components import axis from homeassistant.components.axis.const import ( CONF_EVENTS, @@ -283,7 +282,6 @@ async def setup_axis_integration(hass, config=ENTRY_CONFIG, options=ENTRY_OPTION config_entry = MockConfigEntry( domain=AXIS_DOMAIN, data=deepcopy(config), - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, options=deepcopy(options), version=3, unique_id=FORMATTED_MAC, diff --git a/tests/components/bmw_connected_drive/test_config_flow.py b/tests/components/bmw_connected_drive/test_config_flow.py index ba3c69fe9c5..75ca9b4aa1c 100644 --- a/tests/components/bmw_connected_drive/test_config_flow.py +++ b/tests/components/bmw_connected_drive/test_config_flow.py @@ -31,7 +31,6 @@ FIXTURE_CONFIG_ENTRY = { "options": {CONF_READ_ONLY: False, CONF_USE_LOCATION: False}, "system_options": {"disable_new_entities": False}, "source": config_entries.SOURCE_USER, - "connection_class": config_entries.CONN_CLASS_CLOUD_POLL, "unique_id": f"{FIXTURE_USER_INPUT[CONF_REGION]}-{FIXTURE_USER_INPUT[CONF_REGION]}", } diff --git a/tests/components/cast/test_home_assistant_cast.py b/tests/components/cast/test_home_assistant_cast.py index 6ac4f9c9d0c..1e0618b066e 100644 --- a/tests/components/cast/test_home_assistant_cast.py +++ b/tests/components/cast/test_home_assistant_cast.py @@ -2,7 +2,6 @@ from unittest.mock import patch -from homeassistant import config_entries from homeassistant.components.cast import home_assistant_cast from homeassistant.config import async_process_ha_core_config @@ -93,7 +92,6 @@ async def test_use_cloud_url(hass, mock_zeroconf): async def test_remove_entry(hass, mock_zeroconf): """Test removing config entry removes user.""" entry = MockConfigEntry( - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, data={}, domain="cast", title="Google Cast", diff --git a/tests/components/config/test_config_entries.py b/tests/components/config/test_config_entries.py index 2f7815c99bf..8cd86ce6df2 100644 --- a/tests/components/config/test_config_entries.py +++ b/tests/components/config/test_config_entries.py @@ -50,14 +50,13 @@ async def test_get_entries(hass, client): pass hass.helpers.config_entry_flow.register_discovery_flow( - "comp2", "Comp 2", lambda: None, core_ce.CONN_CLASS_ASSUMED + "comp2", "Comp 2", lambda: None ) entry = MockConfigEntry( domain="comp1", title="Test 1", source="bla", - connection_class=core_ce.CONN_CLASS_LOCAL_POLL, ) entry.supports_unload = True entry.add_to_hass(hass) @@ -67,7 +66,6 @@ async def test_get_entries(hass, client): source="bla2", state=core_ce.ENTRY_STATE_SETUP_ERROR, reason="Unsupported API", - connection_class=core_ce.CONN_CLASS_ASSUMED, ).add_to_hass(hass) MockConfigEntry( domain="comp3", @@ -87,7 +85,6 @@ async def test_get_entries(hass, client): "title": "Test 1", "source": "bla", "state": "not_loaded", - "connection_class": "local_poll", "supports_options": True, "supports_unload": True, "disabled_by": None, @@ -98,7 +95,6 @@ async def test_get_entries(hass, client): "title": "Test 2", "source": "bla2", "state": "setup_error", - "connection_class": "assumed", "supports_options": False, "supports_unload": False, "disabled_by": None, @@ -109,7 +105,6 @@ async def test_get_entries(hass, client): "title": "Test 3", "source": "bla3", "state": "not_loaded", - "connection_class": "unknown", "supports_options": False, "supports_unload": False, "disabled_by": core_ce.DISABLED_USER, @@ -326,7 +321,6 @@ async def test_create_account(hass, client): "type": "create_entry", "version": 1, "result": { - "connection_class": "unknown", "disabled_by": None, "domain": "test", "entry_id": entries[0].entry_id, @@ -397,7 +391,6 @@ async def test_two_step_flow(hass, client): "title": "user-title", "version": 1, "result": { - "connection_class": "unknown", "disabled_by": None, "domain": "test", "entry_id": entries[0].entry_id, @@ -596,7 +589,6 @@ async def test_options_flow(hass, client): domain="test", entry_id="test1", source="bla", - connection_class=core_ce.CONN_CLASS_LOCAL_POLL, ).add_to_hass(hass) entry = hass.config_entries.async_entries()[0] @@ -646,7 +638,6 @@ async def test_two_step_options_flow(hass, client): domain="test", entry_id="test1", source="bla", - connection_class=core_ce.CONN_CLASS_LOCAL_POLL, ).add_to_hass(hass) entry = hass.config_entries.async_entries()[0] diff --git a/tests/components/deconz/test_gateway.py b/tests/components/deconz/test_gateway.py index 1712faaf080..8a160b7ef19 100644 --- a/tests/components/deconz/test_gateway.py +++ b/tests/components/deconz/test_gateway.py @@ -32,7 +32,7 @@ from homeassistant.components.ssdp import ( ATTR_UPNP_UDN, ) from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN -from homeassistant.config_entries import CONN_CLASS_LOCAL_PUSH, SOURCE_SSDP, SOURCE_USER +from homeassistant.config_entries import SOURCE_SSDP, SOURCE_USER from homeassistant.const import ( CONF_API_KEY, CONF_HOST, @@ -116,7 +116,6 @@ async def setup_deconz_integration( domain=DECONZ_DOMAIN, source=source, data=deepcopy(config), - connection_class=CONN_CLASS_LOCAL_PUSH, options=deepcopy(options), entry_id=entry_id, unique_id=unique_id, diff --git a/tests/components/eafm/test_sensor.py b/tests/components/eafm/test_sensor.py index 3f2eb72a8e3..6f5dcaa9284 100644 --- a/tests/components/eafm/test_sensor.py +++ b/tests/components/eafm/test_sensor.py @@ -31,7 +31,6 @@ async def async_setup_test_fixture(hass, mock_get_station, initial_value): entry_id="VikingRecorder1234", data={"station": "L1234"}, title="Viking Recorder", - connection_class=config_entries.CONN_CLASS_CLOUD_PUSH, ) entry.add_to_hass(hass) diff --git a/tests/components/forked_daapd/test_config_flow.py b/tests/components/forked_daapd/test_config_flow.py index 843aa12a759..a99f91d3f91 100644 --- a/tests/components/forked_daapd/test_config_flow.py +++ b/tests/components/forked_daapd/test_config_flow.py @@ -11,11 +11,7 @@ from homeassistant.components.forked_daapd.const import ( CONF_TTS_VOLUME, DOMAIN, ) -from homeassistant.config_entries import ( - CONN_CLASS_LOCAL_PUSH, - SOURCE_USER, - SOURCE_ZEROCONF, -) +from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT from tests.common import MockConfigEntry @@ -52,7 +48,6 @@ def config_entry_fixture(): options={}, system_options={}, source=SOURCE_USER, - connection_class=CONN_CLASS_LOCAL_PUSH, entry_id=1, ) diff --git a/tests/components/forked_daapd/test_media_player.py b/tests/components/forked_daapd/test_media_player.py index ffbf7a569f9..032e3dde22c 100644 --- a/tests/components/forked_daapd/test_media_player.py +++ b/tests/components/forked_daapd/test_media_player.py @@ -54,7 +54,7 @@ from homeassistant.components.media_player.const import ( MEDIA_TYPE_MUSIC, MEDIA_TYPE_TVSHOW, ) -from homeassistant.config_entries import CONN_CLASS_LOCAL_PUSH, SOURCE_USER +from homeassistant.config_entries import SOURCE_USER from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, @@ -284,7 +284,6 @@ def config_entry_fixture(): options={CONF_TTS_PAUSE_TIME: 0}, system_options={}, source=SOURCE_USER, - connection_class=CONN_CLASS_LOCAL_PUSH, entry_id=1, ) diff --git a/tests/components/home_plus_control/conftest.py b/tests/components/home_plus_control/conftest.py index cb9c869002f..4b60f2623c4 100644 --- a/tests/components/home_plus_control/conftest.py +++ b/tests/components/home_plus_control/conftest.py @@ -3,7 +3,6 @@ from homepluscontrol.homeplusinteractivemodule import HomePlusInteractiveModule from homepluscontrol.homeplusplant import HomePlusPlant import pytest -from homeassistant import config_entries from homeassistant.components.home_plus_control.const import DOMAIN from tests.common import MockConfigEntry @@ -35,7 +34,6 @@ def mock_config_entry(): }, }, source="test", - connection_class=config_entries.CONN_CLASS_LOCAL_POLL, options={}, system_options={"disable_new_entities": False}, unique_id=DOMAIN, diff --git a/tests/components/homekit_controller/common.py b/tests/components/homekit_controller/common.py index a1b5f37324d..c3c182c8b51 100644 --- a/tests/components/homekit_controller/common.py +++ b/tests/components/homekit_controller/common.py @@ -9,7 +9,6 @@ from aiohomekit.model.characteristics import CharacteristicsTypes from aiohomekit.model.services import ServicesTypes from aiohomekit.testing import FakeController -from homeassistant import config_entries from homeassistant.components.homekit_controller import config_flow from homeassistant.components.homekit_controller.const import ( CONTROLLER, @@ -99,7 +98,6 @@ async def setup_test_accessories(hass, accessories): entry_id="TestData", data={"AccessoryPairingID": pairing_id}, title="test", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, ) config_entry.add_to_hass(hass) diff --git a/tests/components/homekit_controller/test_storage.py b/tests/components/homekit_controller/test_storage.py index 4f0dabb9bc8..b1c3ee9ff4c 100644 --- a/tests/components/homekit_controller/test_storage.py +++ b/tests/components/homekit_controller/test_storage.py @@ -95,7 +95,6 @@ async def test_storage_is_removed_on_config_entry_removal(hass, utcnow): "TestData", pairing_data, "test", - config_entries.CONN_CLASS_LOCAL_PUSH, system_options={}, ) diff --git a/tests/components/homematicip_cloud/conftest.py b/tests/components/homematicip_cloud/conftest.py index 2d21f9cf861..b5dd6105e0f 100644 --- a/tests/components/homematicip_cloud/conftest.py +++ b/tests/components/homematicip_cloud/conftest.py @@ -62,7 +62,6 @@ def hmip_config_entry_fixture() -> config_entries.ConfigEntry: unique_id=HAPID, data=entry_data, source=SOURCE_IMPORT, - connection_class=config_entries.CONN_CLASS_CLOUD_PUSH, system_options={"disable_new_entities": False}, ) diff --git a/tests/components/hue/conftest.py b/tests/components/hue/conftest.py index 3fc55692cc4..f8bee35425c 100644 --- a/tests/components/hue/conftest.py +++ b/tests/components/hue/conftest.py @@ -8,7 +8,6 @@ from aiohue.scenes import Scenes from aiohue.sensors import Sensors import pytest -from homeassistant import config_entries from homeassistant.components import hue from homeassistant.components.hue import sensor_base as hue_sensor_base @@ -116,7 +115,6 @@ async def setup_bridge_for_sensors(hass, mock_bridge, hostname=None): domain=hue.DOMAIN, title="Mock Title", data={"host": hostname}, - connection_class=config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, ) mock_bridge.config_entry = config_entry diff --git a/tests/components/hue/test_bridge.py b/tests/components/hue/test_bridge.py index 9792eefba5e..bc7573851ad 100644 --- a/tests/components/hue/test_bridge.py +++ b/tests/components/hue/test_bridge.py @@ -166,7 +166,6 @@ async def test_hue_activate_scene(hass, mock_api): "Mock Title", {"host": "mock-host", "username": "mock-username"}, "test", - config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, options={CONF_ALLOW_HUE_GROUPS: True, CONF_ALLOW_UNREACHABLE: False}, ) @@ -201,7 +200,6 @@ async def test_hue_activate_scene_transition(hass, mock_api): "Mock Title", {"host": "mock-host", "username": "mock-username"}, "test", - config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, options={CONF_ALLOW_HUE_GROUPS: True, CONF_ALLOW_UNREACHABLE: False}, ) @@ -236,7 +234,6 @@ async def test_hue_activate_scene_group_not_found(hass, mock_api): "Mock Title", {"host": "mock-host", "username": "mock-username"}, "test", - config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, options={CONF_ALLOW_HUE_GROUPS: True, CONF_ALLOW_UNREACHABLE: False}, ) @@ -266,7 +263,6 @@ async def test_hue_activate_scene_scene_not_found(hass, mock_api): "Mock Title", {"host": "mock-host", "username": "mock-username"}, "test", - config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, options={CONF_ALLOW_HUE_GROUPS: True, CONF_ALLOW_UNREACHABLE: False}, ) diff --git a/tests/components/hue/test_init_multiple_bridges.py b/tests/components/hue/test_init_multiple_bridges.py index 4e5378ae5e1..cd36a5d4f77 100644 --- a/tests/components/hue/test_init_multiple_bridges.py +++ b/tests/components/hue/test_init_multiple_bridges.py @@ -7,7 +7,6 @@ from aiohue.scenes import Scenes from aiohue.sensors import Sensors import pytest -from homeassistant import config_entries from homeassistant.components import hue from homeassistant.components.hue import sensor_base as hue_sensor_base from homeassistant.setup import async_setup_component @@ -132,7 +131,6 @@ def create_config_entry(): return MockConfigEntry( domain=hue.DOMAIN, data={"host": "mock-host"}, - connection_class=config_entries.CONN_CLASS_LOCAL_POLL, ) diff --git a/tests/components/hue/test_light.py b/tests/components/hue/test_light.py index df873536ce2..105fd2a7271 100644 --- a/tests/components/hue/test_light.py +++ b/tests/components/hue/test_light.py @@ -179,7 +179,6 @@ async def setup_bridge(hass, mock_bridge): "Mock Title", {"host": "mock-host"}, "test", - config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, ) mock_bridge.config_entry = config_entry diff --git a/tests/components/huisbaasje/test_init.py b/tests/components/huisbaasje/test_init.py index 2d68cdf8a11..1c081936cb8 100644 --- a/tests/components/huisbaasje/test_init.py +++ b/tests/components/huisbaasje/test_init.py @@ -5,7 +5,6 @@ from huisbaasje import HuisbaasjeException from homeassistant.components import huisbaasje from homeassistant.config_entries import ( - CONN_CLASS_CLOUD_POLL, ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED, ENTRY_STATE_SETUP_ERROR, @@ -46,7 +45,6 @@ async def test_setup_entry(hass: HomeAssistant): CONF_PASSWORD: "password", }, source="test", - connection_class=CONN_CLASS_CLOUD_POLL, system_options={}, ) config_entry.add_to_hass(hass) @@ -87,7 +85,6 @@ async def test_setup_entry_error(hass: HomeAssistant): CONF_PASSWORD: "password", }, source="test", - connection_class=CONN_CLASS_CLOUD_POLL, system_options={}, ) config_entry.add_to_hass(hass) @@ -129,7 +126,6 @@ async def test_unload_entry(hass: HomeAssistant): CONF_PASSWORD: "password", }, source="test", - connection_class=CONN_CLASS_CLOUD_POLL, system_options={}, ) config_entry.add_to_hass(hass) diff --git a/tests/components/huisbaasje/test_sensor.py b/tests/components/huisbaasje/test_sensor.py index cfb17cd5f2d..c753c89627d 100644 --- a/tests/components/huisbaasje/test_sensor.py +++ b/tests/components/huisbaasje/test_sensor.py @@ -2,7 +2,6 @@ from unittest.mock import patch from homeassistant.components import huisbaasje -from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant @@ -35,7 +34,6 @@ async def test_setup_entry(hass: HomeAssistant): CONF_PASSWORD: "password", }, source="test", - connection_class=CONN_CLASS_CLOUD_POLL, system_options={}, ) config_entry.add_to_hass(hass) @@ -92,7 +90,6 @@ async def test_setup_entry_absent_measurement(hass: HomeAssistant): CONF_PASSWORD: "password", }, source="test", - connection_class=CONN_CLASS_CLOUD_POLL, system_options={}, ) config_entry.add_to_hass(hass) diff --git a/tests/components/hvv_departures/test_config_flow.py b/tests/components/hvv_departures/test_config_flow.py index 2042c6b95d1..4a18e639315 100644 --- a/tests/components/hvv_departures/test_config_flow.py +++ b/tests/components/hvv_departures/test_config_flow.py @@ -11,7 +11,7 @@ from homeassistant.components.hvv_departures.const import ( CONF_STATION, DOMAIN, ) -from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, SOURCE_USER +from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_HOST, CONF_OFFSET, CONF_PASSWORD, CONF_USERNAME from tests.common import MockConfigEntry, load_fixture @@ -256,7 +256,6 @@ async def test_options_flow(hass): title="Wartenau", data=FIXTURE_CONFIG_ENTRY, source=SOURCE_USER, - connection_class=CONN_CLASS_CLOUD_POLL, system_options={"disable_new_entities": False}, options=FIXTURE_OPTIONS, unique_id="1234", @@ -307,7 +306,6 @@ async def test_options_flow_invalid_auth(hass): title="Wartenau", data=FIXTURE_CONFIG_ENTRY, source=SOURCE_USER, - connection_class=CONN_CLASS_CLOUD_POLL, system_options={"disable_new_entities": False}, options=FIXTURE_OPTIONS, unique_id="1234", @@ -348,7 +346,6 @@ async def test_options_flow_cannot_connect(hass): title="Wartenau", data=FIXTURE_CONFIG_ENTRY, source=SOURCE_USER, - connection_class=CONN_CLASS_CLOUD_POLL, system_options={"disable_new_entities": False}, options=FIXTURE_OPTIONS, unique_id="1234", diff --git a/tests/components/mobile_app/test_notify.py b/tests/components/mobile_app/test_notify.py index 5041b2453d9..8823fefd92c 100644 --- a/tests/components/mobile_app/test_notify.py +++ b/tests/components/mobile_app/test_notify.py @@ -34,7 +34,6 @@ async def setup_push_receiver(hass, aioclient_mock): ) entry = MockConfigEntry( - connection_class="cloud_push", data={ "app_data": {"push_token": "PUSH_TOKEN", "push_url": push_url}, "app_id": "io.homeassistant.mobile_app", @@ -62,7 +61,6 @@ async def setup_push_receiver(hass, aioclient_mock): await hass.async_block_till_done() loaded_late_entry = MockConfigEntry( - connection_class="cloud_push", data={ "app_data": {"push_token": "PUSH_TOKEN2", "push_url": f"{push_url}2"}, "app_id": "io.homeassistant.mobile_app", diff --git a/tests/components/onewire/__init__.py b/tests/components/onewire/__init__.py index 088c6a3ad11..1712a5500dd 100644 --- a/tests/components/onewire/__init__.py +++ b/tests/components/onewire/__init__.py @@ -14,7 +14,7 @@ from homeassistant.components.onewire.const import ( DEFAULT_SYSBUS_MOUNT_DIR, DOMAIN, ) -from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, SOURCE_USER +from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TYPE from .const import MOCK_OWPROXY_DEVICES, MOCK_SYSBUS_DEVICES @@ -32,7 +32,6 @@ async def setup_onewire_sysbus_integration(hass): CONF_MOUNT_DIR: DEFAULT_SYSBUS_MOUNT_DIR, }, unique_id=f"{CONF_TYPE_SYSBUS}:{DEFAULT_SYSBUS_MOUNT_DIR}", - connection_class=CONN_CLASS_LOCAL_POLL, options={}, entry_id="1", ) @@ -57,7 +56,6 @@ async def setup_onewire_owserver_integration(hass): CONF_HOST: "1.2.3.4", CONF_PORT: 1234, }, - connection_class=CONN_CLASS_LOCAL_POLL, options={}, entry_id="2", ) @@ -85,7 +83,6 @@ async def setup_onewire_patched_owserver_integration(hass): "10.111111111111": "My DS18B20", }, }, - connection_class=CONN_CLASS_LOCAL_POLL, options={}, entry_id="2", ) diff --git a/tests/components/onewire/test_init.py b/tests/components/onewire/test_init.py index 21e512a2229..4a3724c5dd0 100644 --- a/tests/components/onewire/test_init.py +++ b/tests/components/onewire/test_init.py @@ -6,7 +6,6 @@ from pyownet.protocol import ConnError, OwnetError from homeassistant.components.onewire.const import CONF_TYPE_OWSERVER, DOMAIN from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.config_entries import ( - CONN_CLASS_LOCAL_POLL, ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED, ENTRY_STATE_SETUP_RETRY, @@ -37,7 +36,6 @@ async def test_owserver_connect_failure(hass): CONF_PORT: "1234", }, unique_id=f"{CONF_TYPE_OWSERVER}:1.2.3.4:1234", - connection_class=CONN_CLASS_LOCAL_POLL, options={}, entry_id="2", ) @@ -66,7 +64,6 @@ async def test_failed_owserver_listing(hass): CONF_PORT: "1234", }, unique_id=f"{CONF_TYPE_OWSERVER}:1.2.3.4:1234", - connection_class=CONN_CLASS_LOCAL_POLL, options={}, entry_id="2", ) diff --git a/tests/components/onvif/test_config_flow.py b/tests/components/onvif/test_config_flow.py index a8827247689..2bacd61e09f 100644 --- a/tests/components/onvif/test_config_flow.py +++ b/tests/components/onvif/test_config_flow.py @@ -153,7 +153,6 @@ async def setup_onvif_integration( domain=config_flow.DOMAIN, source=source, data={**config}, - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, options=options or {}, entry_id=entry_id, unique_id=unique_id, diff --git a/tests/components/ozw/common.py b/tests/components/ozw/common.py index 1467d619afe..2c1c81aea6d 100644 --- a/tests/components/ozw/common.py +++ b/tests/components/ozw/common.py @@ -17,7 +17,6 @@ async def setup_ozw(hass, entry=None, fixture=None): entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, ) entry.add_to_hass(hass) diff --git a/tests/components/ozw/test_init.py b/tests/components/ozw/test_init.py index 339b690f4e4..e0232955997 100644 --- a/tests/components/ozw/test_init.py +++ b/tests/components/ozw/test_init.py @@ -31,7 +31,6 @@ async def test_setup_entry_without_mqtt(hass): entry = MockConfigEntry( domain=DOMAIN, title="OpenZWave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, ) entry.add_to_hass(hass) @@ -64,7 +63,6 @@ async def test_unload_entry(hass, generic_data, switch_msg, caplog): entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, ) entry.add_to_hass(hass) assert entry.state == config_entries.ENTRY_STATE_NOT_LOADED @@ -112,7 +110,6 @@ async def test_remove_entry(hass, stop_addon, uninstall_addon, caplog): entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, data={"integration_created_addon": False}, ) entry.add_to_hass(hass) @@ -128,7 +125,6 @@ async def test_remove_entry(hass, stop_addon, uninstall_addon, caplog): entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, data={"integration_created_addon": True}, ) entry.add_to_hass(hass) @@ -178,7 +174,6 @@ async def test_setup_entry_with_addon(hass, get_addon_discovery_info): entry = MockConfigEntry( domain=DOMAIN, title="OpenZWave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, data={"use_addon": True}, ) entry.add_to_hass(hass) @@ -205,7 +200,6 @@ async def test_setup_entry_without_addon_info(hass, get_addon_discovery_info): entry = MockConfigEntry( domain=DOMAIN, title="OpenZWave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, data={"use_addon": True}, ) entry.add_to_hass(hass) @@ -226,7 +220,6 @@ async def test_unload_entry_with_addon( entry = MockConfigEntry( domain=DOMAIN, title="OpenZWave", - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, data={"use_addon": True}, ) entry.add_to_hass(hass) diff --git a/tests/components/picnic/test_sensor.py b/tests/components/picnic/test_sensor.py index 08a2e0282c0..098d86785ab 100644 --- a/tests/components/picnic/test_sensor.py +++ b/tests/components/picnic/test_sensor.py @@ -10,7 +10,6 @@ import requests from homeassistant import config_entries from homeassistant.components.picnic import const from homeassistant.components.picnic.const import CONF_COUNTRY_CODE, SENSOR_TYPES -from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL from homeassistant.const import ( CONF_ACCESS_TOKEN, CURRENCY_EURO, @@ -110,7 +109,6 @@ class TestPicnicSensor(unittest.IsolatedAsyncioTestCase): self.config_entry = MockConfigEntry( domain=const.DOMAIN, data=config_data, - connection_class=CONN_CLASS_CLOUD_POLL, unique_id="295-6y3-1nf4", ) self.config_entry.add_to_hass(self.hass) diff --git a/tests/components/smartthings/conftest.py b/tests/components/smartthings/conftest.py index d145e7644a9..be822371030 100644 --- a/tests/components/smartthings/conftest.py +++ b/tests/components/smartthings/conftest.py @@ -37,7 +37,7 @@ from homeassistant.components.smartthings.const import ( STORAGE_VERSION, ) from homeassistant.config import async_process_ha_core_config -from homeassistant.config_entries import CONN_CLASS_CLOUD_PUSH, SOURCE_USER, ConfigEntry +from homeassistant.config_entries import SOURCE_USER, ConfigEntry from homeassistant.const import ( CONF_ACCESS_TOKEN, CONF_CLIENT_ID, @@ -61,7 +61,6 @@ async def setup_platform(hass, platform: str, *, devices=None, scenes=None): "Test", {CONF_INSTALLED_APP_ID: str(uuid4())}, SOURCE_USER, - CONN_CLASS_CLOUD_PUSH, system_options={}, ) broker = DeviceBroker( @@ -231,7 +230,6 @@ def config_entry_fixture(hass, installed_app, location): title=location.name, version=2, source=SOURCE_USER, - connection_class=CONN_CLASS_CLOUD_PUSH, ) diff --git a/tests/components/srp_energy/__init__.py b/tests/components/srp_energy/__init__.py index e14f9186f44..c3966e940b0 100644 --- a/tests/components/srp_energy/__init__.py +++ b/tests/components/srp_energy/__init__.py @@ -38,7 +38,6 @@ async def init_integration( domain=srp_energy.SRP_ENERGY_DOMAIN, source=source, data=config, - connection_class=config_entries.CONN_CLASS_CLOUD_POLL, options=options, entry_id=entry_id, ) diff --git a/tests/components/tasmota/conftest.py b/tests/components/tasmota/conftest.py index 5c0b7d315f9..aa73e4d9994 100644 --- a/tests/components/tasmota/conftest.py +++ b/tests/components/tasmota/conftest.py @@ -4,7 +4,6 @@ from unittest.mock import patch from hatasmota.discovery import get_status_sensor_entities import pytest -from homeassistant import config_entries from homeassistant.components.tasmota.const import ( CONF_DISCOVERY_PREFIX, DEFAULT_PREFIX, @@ -64,7 +63,6 @@ async def setup_tasmota_helper(hass): hass.config.components.add("tasmota") entry = MockConfigEntry( - connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, data={CONF_DISCOVERY_PREFIX: DEFAULT_PREFIX}, domain=DOMAIN, title="Tasmota", diff --git a/tests/components/unifi/test_device_tracker.py b/tests/components/unifi/test_device_tracker.py index 2018ae39b64..62a52b500f9 100644 --- a/tests/components/unifi/test_device_tracker.py +++ b/tests/components/unifi/test_device_tracker.py @@ -943,7 +943,6 @@ async def test_restoring_client(hass, aioclient_mock): title="Mock Title", data=ENTRY_CONFIG, source="test", - connection_class=config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, options={}, entry_id=1, diff --git a/tests/components/unifi/test_switch.py b/tests/components/unifi/test_switch.py index b8f6e2da553..5c4a65e0a78 100644 --- a/tests/components/unifi/test_switch.py +++ b/tests/components/unifi/test_switch.py @@ -793,7 +793,6 @@ async def test_restore_client_succeed(hass, aioclient_mock): title="Mock Title", data=ENTRY_CONFIG, source="test", - connection_class=config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, options={}, entry_id=1, @@ -885,7 +884,6 @@ async def test_restore_client_no_old_state(hass, aioclient_mock): title="Mock Title", data=ENTRY_CONFIG, source="test", - connection_class=config_entries.CONN_CLASS_LOCAL_POLL, system_options={}, options={}, entry_id=1, diff --git a/tests/components/zwave/test_lock.py b/tests/components/zwave/test_lock.py index 9050f06f87b..f265b36dcb6 100644 --- a/tests/components/zwave/test_lock.py +++ b/tests/components/zwave/test_lock.py @@ -286,7 +286,6 @@ async def setup_ozw(hass, mock_openzwave): "Mock Title", {"usb_path": "mock-path", "network_key": "mock-key"}, "test", - config_entries.CONN_CLASS_LOCAL_PUSH, system_options={}, ) await hass.config_entries.async_forward_entry_setup(config_entry, "lock") diff --git a/tests/components/zwave_js/test_init.py b/tests/components/zwave_js/test_init.py index f9784e0f9b8..80b37301383 100644 --- a/tests/components/zwave_js/test_init.py +++ b/tests/components/zwave_js/test_init.py @@ -10,7 +10,6 @@ from homeassistant.components.hassio.handler import HassioAPIError from homeassistant.components.zwave_js.const import DOMAIN from homeassistant.components.zwave_js.helpers import get_device_id from homeassistant.config_entries import ( - CONN_CLASS_LOCAL_PUSH, DISABLED_USER, ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED, @@ -584,7 +583,6 @@ async def test_start_addon( entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave JS", - connection_class=CONN_CLASS_LOCAL_PUSH, data={"use_addon": True, "usb_path": device, "network_key": network_key}, ) entry.add_to_hass(hass) @@ -616,7 +614,6 @@ async def test_install_addon( entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave JS", - connection_class=CONN_CLASS_LOCAL_PUSH, data={"use_addon": True, "usb_path": device, "network_key": network_key}, ) entry.add_to_hass(hass) @@ -650,7 +647,6 @@ async def test_addon_info_failure( entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave JS", - connection_class=CONN_CLASS_LOCAL_PUSH, data={"use_addon": True, "usb_path": device, "network_key": network_key}, ) entry.add_to_hass(hass) @@ -700,7 +696,6 @@ async def test_update_addon( entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave JS", - connection_class=CONN_CLASS_LOCAL_PUSH, data={ "url": "ws://host1:3001", "use_addon": True, @@ -742,7 +737,6 @@ async def test_stop_addon( entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave JS", - connection_class=CONN_CLASS_LOCAL_PUSH, data={ "url": "ws://host1:3001", "use_addon": True, @@ -773,7 +767,6 @@ async def test_remove_entry( entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave JS", - connection_class=CONN_CLASS_LOCAL_PUSH, data={"integration_created_addon": False}, ) entry.add_to_hass(hass) @@ -789,7 +782,6 @@ async def test_remove_entry( entry = MockConfigEntry( domain=DOMAIN, title="Z-Wave JS", - connection_class=CONN_CLASS_LOCAL_PUSH, data={"integration_created_addon": True}, ) entry.add_to_hass(hass) diff --git a/tests/helpers/test_config_entry_flow.py b/tests/helpers/test_config_entry_flow.py index edee75fe240..7f54ba99c8a 100644 --- a/tests/helpers/test_config_entry_flow.py +++ b/tests/helpers/test_config_entry_flow.py @@ -26,7 +26,7 @@ def discovery_flow_conf(hass): with patch.dict(config_entries.HANDLERS): config_entry_flow.register_discovery_flow( - "test", "Test", has_discovered_devices, config_entries.CONN_CLASS_LOCAL_POLL + "test", "Test", has_discovered_devices ) yield handler_conf @@ -344,3 +344,14 @@ async def test_webhook_create_cloudhook(hass, webhook_flow_conf): assert len(mock_delete.mock_calls) == 1 assert result["require_restart"] is False + + +async def test_warning_deprecated_connection_class(hass, caplog): + """Test that we log a warning when the connection_class is used.""" + discovery_function = Mock() + with patch.dict(config_entries.HANDLERS): + config_entry_flow.register_discovery_flow( + "test", "Test", discovery_function, connection_class="local_polling" + ) + + assert "integration is setting a connection_class" in caplog.text diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index b9f9424b6f0..9c6e469291e 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -546,7 +546,6 @@ async def test_saving_and_loading(hass): """Test flow.""" VERSION = 5 - CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL async def async_step_user(self, user_input=None): """Test user step.""" @@ -562,7 +561,6 @@ async def test_saving_and_loading(hass): """Test flow.""" VERSION = 3 - CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_PUSH async def async_step_user(self, user_input=None): """Test user step.""" @@ -597,7 +595,6 @@ async def test_saving_and_loading(hass): assert orig.title == loaded.title assert orig.data == loaded.data assert orig.source == loaded.source - assert orig.connection_class == loaded.connection_class assert orig.unique_id == loaded.unique_id