Clean up superfluous integration setup - part 5 (#49296)
parent
969c147b77
commit
af80ca6795
|
@ -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(
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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."""
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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."""
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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] = []
|
||||
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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."""
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue