diff --git a/homeassistant/components/brunt/config_flow.py b/homeassistant/components/brunt/config_flow.py index 636a9affddd..c81eb2de6ca 100644 --- a/homeassistant/components/brunt/config_flow.py +++ b/homeassistant/components/brunt/config_flow.py @@ -111,9 +111,3 @@ class BruntConfigFlow(ConfigFlow, domain=DOMAIN): self.hass.config_entries.async_update_entry(self._reauth_entry, data=user_input) await self.hass.config_entries.async_reload(self._reauth_entry.entry_id) return self.async_abort(reason="reauth_successful") - - async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: - """Import config from configuration.yaml.""" - await self.async_set_unique_id(import_config[CONF_USERNAME].lower()) - self._abort_if_unique_id_configured() - return await self.async_step_user(import_config) diff --git a/homeassistant/components/brunt/cover.py b/homeassistant/components/brunt/cover.py index d3efdce0a5b..8bbb11914f7 100644 --- a/homeassistant/components/brunt/cover.py +++ b/homeassistant/components/brunt/cover.py @@ -2,7 +2,6 @@ from __future__ import annotations from collections.abc import MutableMapping -import logging from typing import Any from aiohttp.client_exceptions import ClientResponseError @@ -16,12 +15,11 @@ from homeassistant.components.cover import ( CoverDeviceClass, CoverEntity, ) -from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry +from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -39,28 +37,9 @@ from .const import ( REGULAR_INTERVAL, ) -_LOGGER = logging.getLogger(__name__) - COVER_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION -async def async_setup_platform( - hass: HomeAssistant, - config: ConfigType, - add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Component setup, run import config flow for each entry in config.""" - _LOGGER.warning( - "Loading brunt via platform config is deprecated; The configuration has been migrated to a config entry and can be safely removed from configuration.yaml" - ) - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_IMPORT}, data=config - ) - ) - - async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, diff --git a/tests/components/brunt/test_config_flow.py b/tests/components/brunt/test_config_flow.py index f053a6d18b0..4a949911ca6 100644 --- a/tests/components/brunt/test_config_flow.py +++ b/tests/components/brunt/test_config_flow.py @@ -41,54 +41,6 @@ async def test_form(hass): assert len(mock_setup_entry.mock_calls) == 1 -async def test_import(hass): - """Test we get the form.""" - - with patch( - "homeassistant.components.brunt.config_flow.BruntClientAsync.async_login", - return_value=None, - ), patch( - "homeassistant.components.brunt.async_setup_entry", - return_value=True, - ) as mock_setup_entry: - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=CONFIG - ) - - await hass.async_block_till_done() - - assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY - assert result["title"] == "test-username" - assert result["data"] == CONFIG - assert len(mock_setup_entry.mock_calls) == 1 - - -async def test_import_duplicate_login(hass): - """Test uniqueness of username.""" - entry = MockConfigEntry( - domain=DOMAIN, - data=CONFIG, - title="test-username", - unique_id="test-username", - ) - entry.add_to_hass(hass) - - with patch( - "homeassistant.components.brunt.config_flow.BruntClientAsync.async_login", - return_value=None, - ), patch( - "homeassistant.components.brunt.async_setup_entry", - return_value=True, - ): - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data=CONFIG - ) - await hass.async_block_till_done() - - assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT - assert result["reason"] == "already_configured" - - async def test_form_duplicate_login(hass): """Test uniqueness of username.""" entry = MockConfigEntry(