diff --git a/homeassistant/components/melissa/__init__.py b/homeassistant/components/melissa/__init__.py index 830036b072a..c03939e3e9c 100644 --- a/homeassistant/components/melissa/__init__.py +++ b/homeassistant/components/melissa/__init__.py @@ -1,9 +1,10 @@ """Support for Melissa climate.""" import logging +import melissa import voluptuous as vol -from homeassistant.const import CONF_USERNAME, CONF_PASSWORD +from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import config_validation as cv from homeassistant.helpers.discovery import async_load_platform @@ -28,8 +29,6 @@ CONFIG_SCHEMA = vol.Schema( async def async_setup(hass, config): """Set up the Melissa Climate component.""" - import melissa - conf = config[DOMAIN] username = conf.get(CONF_USERNAME) password = conf.get(CONF_PASSWORD) diff --git a/tests/components/melissa/test_init.py b/tests/components/melissa/test_init.py index dfdaf80981f..892f4d60a44 100644 --- a/tests/components/melissa/test_init.py +++ b/tests/components/melissa/test_init.py @@ -1,14 +1,15 @@ """The test for the Melissa Climate component.""" -from tests.common import MockDependency, mock_coro_func - from homeassistant.components import melissa +from tests.common import MockDependency, mock_coro_func + VALID_CONFIG = {"melissa": {"username": "********", "password": "********"}} async def test_setup(hass): """Test setting up the Melissa component.""" with MockDependency("melissa") as mocked_melissa: + melissa.melissa = mocked_melissa mocked_melissa.AsyncMelissa().async_connect = mock_coro_func() await melissa.async_setup(hass, VALID_CONFIG)