2017-12-26 19:12:28 +00:00
|
|
|
"""NuHeat component tests."""
|
2020-03-23 05:29:45 +00:00
|
|
|
from homeassistant.components.nuheat.const import DOMAIN
|
|
|
|
from homeassistant.setup import async_setup_component
|
2017-12-26 19:12:28 +00:00
|
|
|
|
2020-03-23 05:29:45 +00:00
|
|
|
from .mocks import _get_mock_nuheat
|
2019-10-23 15:30:38 +00:00
|
|
|
|
2020-05-03 18:27:19 +00:00
|
|
|
from tests.async_mock import patch
|
|
|
|
|
2017-12-26 19:12:28 +00:00
|
|
|
VALID_CONFIG = {
|
2019-07-31 19:25:30 +00:00
|
|
|
"nuheat": {"username": "warm", "password": "feet", "devices": "thermostat123"}
|
2017-12-26 19:12:28 +00:00
|
|
|
}
|
2020-03-23 05:29:45 +00:00
|
|
|
INVALID_CONFIG = {"nuheat": {"username": "warm", "password": "feet"}}
|
2017-12-26 19:12:28 +00:00
|
|
|
|
|
|
|
|
2020-03-23 05:29:45 +00:00
|
|
|
async def test_init_success(hass):
|
|
|
|
"""Test that we can setup with valid config."""
|
|
|
|
mock_nuheat = _get_mock_nuheat()
|
2017-12-26 19:12:28 +00:00
|
|
|
|
2020-03-23 05:29:45 +00:00
|
|
|
with patch(
|
|
|
|
"homeassistant.components.nuheat.nuheat.NuHeat", return_value=mock_nuheat,
|
|
|
|
):
|
|
|
|
assert await async_setup_component(hass, DOMAIN, VALID_CONFIG)
|
|
|
|
await hass.async_block_till_done()
|