Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions homeassistant/components/notion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

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
Expand All @@ -34,39 +33,12 @@
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


Expand Down
4 changes: 0 additions & 4 deletions homeassistant/components/notion/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ async def _show_form(self, errors=None):
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:
Expand Down
17 changes: 0 additions & 17 deletions tests/components/notion/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down