From 82e280d2ac0a5b2529e630b7ee1263ee1cea7b27 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Mon, 13 Dec 2021 17:04:50 -0500 Subject: [PATCH] Remove deprecated yaml config from flume (#61517) --- homeassistant/components/flume/config_flow.py | 4 -- homeassistant/components/flume/sensor.py | 36 +----------------- tests/components/flume/test_config_flow.py | 38 ------------------- 3 files changed, 2 insertions(+), 76 deletions(-) diff --git a/homeassistant/components/flume/config_flow.py b/homeassistant/components/flume/config_flow.py index 1bab8817dbb..6d9554f42c0 100644 --- a/homeassistant/components/flume/config_flow.py +++ b/homeassistant/components/flume/config_flow.py @@ -103,10 +103,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): step_id="user", data_schema=DATA_SCHEMA, errors=errors ) - async def async_step_import(self, user_input): - """Handle import.""" - return await self.async_step_user(user_input) - async def async_step_reauth(self, user_input=None): """Handle reauth.""" self._reauth_unique_id = self.context["unique_id"] diff --git a/homeassistant/components/flume/sensor.py b/homeassistant/components/flume/sensor.py index 2ff7712cfd5..3f7b0f671fe 100644 --- a/homeassistant/components/flume/sensor.py +++ b/homeassistant/components/flume/sensor.py @@ -4,22 +4,9 @@ import logging from numbers import Number from pyflume import FlumeData -import voluptuous as vol -from homeassistant.components.sensor import ( - PLATFORM_SCHEMA, - SensorEntity, - SensorEntityDescription, -) -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import ( - CONF_CLIENT_ID, - CONF_CLIENT_SECRET, - CONF_NAME, - CONF_PASSWORD, - CONF_USERNAME, -) -import homeassistant.helpers.config_validation as cv +from homeassistant.components.sensor import SensorEntity, SensorEntityDescription +from homeassistant.const import CONF_NAME from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, @@ -47,25 +34,6 @@ _LOGGER = logging.getLogger(__name__) MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=15) SCAN_INTERVAL = timedelta(minutes=1) -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Required(CONF_USERNAME): cv.string, - vol.Required(CONF_PASSWORD): cv.string, - vol.Required(CONF_CLIENT_ID): cv.string, - vol.Required(CONF_CLIENT_SECRET): cv.string, - vol.Optional(CONF_NAME): cv.string, - } -) - - -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Import the platform into a config entry.""" - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, context={"source": SOURCE_IMPORT}, data=config - ) - ) - async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Flume sensor.""" diff --git a/tests/components/flume/test_config_flow.py b/tests/components/flume/test_config_flow.py index 70ee359b7b4..4ba7becc147 100644 --- a/tests/components/flume/test_config_flow.py +++ b/tests/components/flume/test_config_flow.py @@ -64,44 +64,6 @@ async def test_form(hass): assert len(mock_setup_entry.mock_calls) == 1 -async def test_form_import(hass): - """Test we can import the sensor platform config.""" - - mock_flume_device_list = _get_mocked_flume_device_list() - - with patch( - "homeassistant.components.flume.config_flow.FlumeAuth", - return_value=True, - ), patch( - "homeassistant.components.flume.config_flow.FlumeDeviceList", - return_value=mock_flume_device_list, - ), patch( - "homeassistant.components.flume.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={ - CONF_USERNAME: "test-username", - CONF_PASSWORD: "test-password", - CONF_CLIENT_ID: "client_id", - CONF_CLIENT_SECRET: "client_secret", - }, - ) - await hass.async_block_till_done() - - assert result["type"] == "create_entry" - assert result["title"] == "test-username" - assert result["data"] == { - CONF_USERNAME: "test-username", - CONF_PASSWORD: "test-password", - CONF_CLIENT_ID: "client_id", - CONF_CLIENT_SECRET: "client_secret", - } - assert len(mock_setup_entry.mock_calls) == 1 - - async def test_form_invalid_auth(hass): """Test we handle invalid auth.""" result = await hass.config_entries.flow.async_init(