core/tests/components/melissa/test_init.py

24 lines
817 B
Python
Raw Normal View History

"""The test for the Melissa Climate component."""
from homeassistant.components import melissa
from tests.common import MockDependency, mock_coro_func
2019-07-31 19:25:30 +00:00
VALID_CONFIG = {"melissa": {"username": "********", "password": "********"}}
async def test_setup(hass):
"""Test setting up the Melissa component."""
2019-07-31 19:25:30 +00:00
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)
mocked_melissa.AsyncMelissa.assert_called_with(
2019-07-31 19:25:30 +00:00
username="********", password="********"
)
assert melissa.DATA_MELISSA in hass.data
2019-07-31 19:25:30 +00:00
assert isinstance(
hass.data[melissa.DATA_MELISSA], type(mocked_melissa.AsyncMelissa())
)