"""Test the Dio Chacon Cover init.""" from unittest.mock import AsyncMock from homeassistant.config_entries import ConfigEntryState from homeassistant.const import EVENT_HOMEASSISTANT_STOP from homeassistant.core import HomeAssistant from . import setup_integration from tests.common import MockConfigEntry async def test_cover_unload_entry( hass: HomeAssistant, mock_dio_chacon_client: AsyncMock, mock_config_entry: MockConfigEntry, ) -> None: """Test the creation and values of the Dio Chacon covers.""" 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 mock_dio_chacon_client.disconnect.assert_called() async def test_cover_shutdown_event( hass: HomeAssistant, mock_dio_chacon_client: AsyncMock, mock_config_entry: MockConfigEntry, ) -> None: """Test the creation and values of the Dio Chacon covers.""" await setup_integration(hass, mock_config_entry) hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP) await hass.async_block_till_done() mock_dio_chacon_client.disconnect.assert_called()