Deprecate YAML config for Notion (0.119 removal) (#43026)
This commit is contained in:
parent
95c9880c52
commit
244bfb2096
3 changed files with 2 additions and 51 deletions
|
@ -5,9 +5,8 @@ import logging
|
|||
|
||||
from aionotion import async_get_client
|
||||
from aionotion.errors import InvalidCredentialsError, NotionError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
@ -34,39 +33,12 @@ ATTR_SYSTEM_NAME = "system_name"
|
|||
DEFAULT_ATTRIBUTION = "Data provided by Notion"
|
||||
DEFAULT_SCAN_INTERVAL = timedelta(minutes=1)
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_USERNAME): cv.string,
|
||||
vol.Required(CONF_PASSWORD): cv.string,
|
||||
}
|
||||
)
|
||||
},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
CONFIG_SCHEMA = cv.deprecated(DOMAIN, invalidation_version="0.119")
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
||||
"""Set up the Notion component."""
|
||||
hass.data[DOMAIN] = {DATA_COORDINATOR: {}}
|
||||
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
|
||||
conf = config[DOMAIN]
|
||||
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_IMPORT},
|
||||
data={
|
||||
CONF_USERNAME: conf[CONF_USERNAME],
|
||||
CONF_PASSWORD: conf[CONF_PASSWORD],
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -28,10 +28,6 @@ class NotionFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
step_id="user", data_schema=self.data_schema, errors=errors or {}
|
||||
)
|
||||
|
||||
async def async_step_import(self, import_config):
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
return await self.async_step_user(import_config)
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Handle the start of the config flow."""
|
||||
if not user_input:
|
||||
|
|
|
@ -68,23 +68,6 @@ async def test_show_form(hass):
|
|||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
async def test_step_import(hass, mock_aionotion):
|
||||
"""Test that the import step works."""
|
||||
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "password123"}
|
||||
|
||||
flow = config_flow.NotionFlowHandler()
|
||||
flow.hass = hass
|
||||
flow.context = {"source": SOURCE_USER}
|
||||
|
||||
result = await flow.async_step_import(import_config=conf)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["title"] == "user@host.com"
|
||||
assert result["data"] == {
|
||||
CONF_USERNAME: "user@host.com",
|
||||
CONF_PASSWORD: "password123",
|
||||
}
|
||||
|
||||
|
||||
async def test_step_user(hass, mock_aionotion):
|
||||
"""Test that the user step works."""
|
||||
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "password123"}
|
||||
|
|
Loading…
Add table
Reference in a new issue