2024-04-17 19:20:12 +00:00
|
|
|
"""Test the Sanix init module."""
|
2024-04-17 12:24:34 +00:00
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from unittest.mock import AsyncMock
|
|
|
|
|
|
|
|
from homeassistant.config_entries import ConfigEntryState
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
from tests.components.sanix import setup_integration
|
|
|
|
|
|
|
|
|
|
|
|
async def test_load_unload_entry(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
mock_sanix: AsyncMock,
|
|
|
|
mock_config_entry: MockConfigEntry,
|
|
|
|
) -> None:
|
|
|
|
"""Test load and unload entry."""
|
|
|
|
await setup_integration(hass, mock_config_entry)
|
|
|
|
|
|
|
|
assert mock_config_entry.state is ConfigEntryState.LOADED
|
|
|
|
|
|
|
|
await hass.config_entries.async_unload(mock_config_entry.entry_id)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
assert mock_config_entry.state is ConfigEntryState.NOT_LOADED
|