mirror of
https://github.com/home-assistant/core.git
synced 2025-06-06 22:27:12 +00:00

* Dio Chacon integration addition with config flow and cover entity * Addition of model information for device * Addition of light and service to force reloading states * Logger improvements * Convert light to switch and usage of v1.0.0 of the api * 100% for tests coverage * Invalid credential implementation and rebase on latest ha dev code * Simplify PR with only one platform * Ruff correction * restore original .gitignore content * Correction of cover state bug when using cover when using actions on cover group. * Begin of corrections following review. * unit tests correction * Refactor with a coordinator as asked by review * Implemented a post constructor callback init method via dio-chacon-api-1.0.2. Improved typing. * Corrections for 2nd review * Reimplemented without coordinator as reviewed with Joostlek * Review improvement * generalize callback in entity * Other review improvements * Refactored tests for readability * Test 100% operationals * Tests review corrections * Tests review corrections * Review tests improvements * simplified tests with snapshots and callback method * Final fixes * Final fixes * Final fixes * Rename to chacon_dio --------- Co-authored-by: Joostlek <joostlek@outlook.com>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""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()
|