2022-03-08 21:28:39 +00:00
|
|
|
"""Define tests for the Airzone init."""
|
|
|
|
|
|
|
|
from unittest.mock import patch
|
|
|
|
|
|
|
|
from homeassistant.components.airzone.const import DOMAIN
|
|
|
|
from homeassistant.config_entries import ConfigEntryState
|
2022-04-02 08:01:49 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2022-03-08 21:28:39 +00:00
|
|
|
|
|
|
|
from .util import CONFIG, HVAC_MOCK
|
|
|
|
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
|
|
|
2022-04-02 08:01:49 +00:00
|
|
|
async def test_unload_entry(hass: HomeAssistant) -> None:
|
2022-03-08 21:28:39 +00:00
|
|
|
"""Test unload."""
|
|
|
|
|
2022-03-09 19:51:39 +00:00
|
|
|
config_entry = MockConfigEntry(
|
|
|
|
domain=DOMAIN, unique_id="airzone_unique_id", data=CONFIG
|
|
|
|
)
|
|
|
|
config_entry.add_to_hass(hass)
|
|
|
|
|
2022-03-08 21:28:39 +00:00
|
|
|
with patch(
|
2022-03-28 08:51:59 +00:00
|
|
|
"homeassistant.components.airzone.AirzoneLocalApi.get_hvac",
|
2022-03-08 21:28:39 +00:00
|
|
|
return_value=HVAC_MOCK,
|
|
|
|
):
|
|
|
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
assert config_entry.state is ConfigEntryState.LOADED
|
|
|
|
|
|
|
|
await hass.config_entries.async_unload(config_entry.entry_id)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
assert config_entry.state is ConfigEntryState.NOT_LOADED
|