2017-12-26 11:12:28 -08:00
|
|
|
"""NuHeat component tests."""
|
2021-01-01 22:31:56 +01:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
2020-03-23 00:29:45 -05:00
|
|
|
from homeassistant.components.nuheat.const import DOMAIN
|
2017-12-26 11:12:28 -08:00
|
|
|
|
2021-01-22 23:27:32 -06:00
|
|
|
from .mocks import MOCK_CONFIG_ENTRY, _get_mock_nuheat
|
|
|
|
|
|
|
|
from tests.common import MockConfigEntry
|
2019-10-23 15:30:38 +00:00
|
|
|
|
2017-12-26 11:12:28 -08:00
|
|
|
VALID_CONFIG = {
|
2019-07-31 12:25:30 -07:00
|
|
|
"nuheat": {"username": "warm", "password": "feet", "devices": "thermostat123"}
|
2017-12-26 11:12:28 -08:00
|
|
|
}
|
2020-03-23 00:29:45 -05:00
|
|
|
INVALID_CONFIG = {"nuheat": {"username": "warm", "password": "feet"}}
|
2017-12-26 11:12:28 -08:00
|
|
|
|
|
|
|
|
2020-03-23 00:29:45 -05:00
|
|
|
async def test_init_success(hass):
|
|
|
|
"""Test that we can setup with valid config."""
|
|
|
|
mock_nuheat = _get_mock_nuheat()
|
2017-12-26 11:12:28 -08:00
|
|
|
|
2020-03-23 00:29:45 -05:00
|
|
|
with patch(
|
2020-08-27 13:56:20 +02:00
|
|
|
"homeassistant.components.nuheat.nuheat.NuHeat",
|
|
|
|
return_value=mock_nuheat,
|
2020-03-23 00:29:45 -05:00
|
|
|
):
|
2021-01-22 23:27:32 -06:00
|
|
|
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG_ENTRY)
|
|
|
|
config_entry.add_to_hass(hass)
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
2020-03-23 00:29:45 -05:00
|
|
|
await hass.async_block_till_done()
|