1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-02 08:26:41 +01:00

Add support for unloading the waterfurnace config (#166555)

This commit is contained in:
Andres Ruiz
2026-03-26 12:16:38 -04:00
committed by GitHub
parent fb65cf48c9
commit 5620cfbfd8
3 changed files with 41 additions and 1 deletions

View File

@@ -138,6 +138,13 @@ async def async_setup_entry(
return True
async def async_unload_entry(
hass: HomeAssistant, entry: WaterFurnaceConfigEntry
) -> bool:
"""Unload a WaterFurnace config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
async def async_migrate_entry(
hass: HomeAssistant, entry: WaterFurnaceConfigEntry
) -> bool:

View File

@@ -29,7 +29,7 @@ rules:
action-exceptions:
status: exempt
comment: This integration does not have custom service actions.
config-entry-unloading: todo
config-entry-unloading: done
docs-configuration-parameters: done
docs-installation-parameters: done
entity-unavailable: done

View File

@@ -2,6 +2,7 @@
from unittest.mock import Mock
import pytest
from waterfurnace.waterfurnace import WFCredentialError
from homeassistant.components.waterfurnace.const import DOMAIN
@@ -99,3 +100,35 @@ async def test_migrate_unique_id_auth_failure(
assert old_entry.state is ConfigEntryState.MIGRATION_ERROR
assert old_entry.unique_id == "TEST_GWID_12345"
@pytest.mark.usefixtures("init_integration")
async def test_unload_entry(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test unloading a 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
@pytest.mark.usefixtures("init_integration")
async def test_reload_entry(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
mock_waterfurnace_client: Mock,
) -> None:
"""Test reloading a config entry."""
assert mock_config_entry.state is ConfigEntryState.LOADED
assert mock_waterfurnace_client.login.call_count == 2
await hass.config_entries.async_reload(mock_config_entry.entry_id)
await hass.async_block_till_done()
assert mock_config_entry.state is ConfigEntryState.LOADED
assert mock_waterfurnace_client.login.call_count == 4
assert "TEST_GWID_12345" in mock_config_entry.runtime_data