hass-core/tests/components/coolmaster/test_init.py
amitfin b5664f9eaf
Bump pycoolmasternet-async and add coolmaster swing mode (#82809)
* Add filter and error code support to CoolMastetNet

* Create separate entities

* coolmaster swing_mode support

* Changed default to False

* Raise HomeAssistantError

* Add tests for init and climate

* Fixed bad merge

* Catch only ValueError
2023-01-03 10:21:11 -08:00

26 lines
924 B
Python

"""The test for the Coolmaster integration."""
from homeassistant.components.coolmaster.const import DOMAIN
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
from homeassistant.core import HomeAssistant
async def test_load_entry(
hass: HomeAssistant,
load_int: ConfigEntry,
) -> None:
"""Test Coolmaster initial load."""
# 2 units times 4 entities (climate, binary_sensor, sensor, button).
assert hass.states.async_entity_ids_count() == 8
assert load_int.state is ConfigEntryState.LOADED
async def test_unload_entry(
hass: HomeAssistant,
load_int: ConfigEntry,
) -> None:
"""Test Coolmaster unloading an entry."""
assert load_int.entry_id in hass.data.get(DOMAIN)
await hass.config_entries.async_unload(load_int.entry_id)
await hass.async_block_till_done()
assert load_int.state is ConfigEntryState.NOT_LOADED
assert not hass.data.get(DOMAIN)