mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Delete KNX config storage when removing the integration (#135071)
This commit is contained in:
parent
f8618e65f6
commit
dc1928f3eb
@ -91,7 +91,7 @@ from .schema import (
|
|||||||
WeatherSchema,
|
WeatherSchema,
|
||||||
)
|
)
|
||||||
from .services import register_knx_services
|
from .services import register_knx_services
|
||||||
from .storage.config_store import KNXConfigStore
|
from .storage.config_store import STORAGE_KEY as CONFIG_STORAGE_KEY, KNXConfigStore
|
||||||
from .telegrams import STORAGE_KEY as TELEGRAMS_STORAGE_KEY, Telegrams
|
from .telegrams import STORAGE_KEY as TELEGRAMS_STORAGE_KEY, Telegrams
|
||||||
from .websocket import register_panel
|
from .websocket import register_panel
|
||||||
|
|
||||||
@ -226,6 +226,8 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|||||||
if knxkeys_filename is not None:
|
if knxkeys_filename is not None:
|
||||||
with contextlib.suppress(FileNotFoundError):
|
with contextlib.suppress(FileNotFoundError):
|
||||||
(storage_dir / knxkeys_filename).unlink()
|
(storage_dir / knxkeys_filename).unlink()
|
||||||
|
with contextlib.suppress(FileNotFoundError):
|
||||||
|
(storage_dir / CONFIG_STORAGE_KEY).unlink()
|
||||||
with contextlib.suppress(FileNotFoundError):
|
with contextlib.suppress(FileNotFoundError):
|
||||||
(storage_dir / PROJECT_STORAGE_KEY).unlink()
|
(storage_dir / PROJECT_STORAGE_KEY).unlink()
|
||||||
with contextlib.suppress(FileNotFoundError):
|
with contextlib.suppress(FileNotFoundError):
|
||||||
|
@ -282,7 +282,7 @@ async def test_async_remove_entry(
|
|||||||
patch("pathlib.Path.rmdir") as rmdir_mock,
|
patch("pathlib.Path.rmdir") as rmdir_mock,
|
||||||
):
|
):
|
||||||
assert await hass.config_entries.async_remove(config_entry.entry_id)
|
assert await hass.config_entries.async_remove(config_entry.entry_id)
|
||||||
assert unlink_mock.call_count == 3
|
assert unlink_mock.call_count == 4
|
||||||
rmdir_mock.assert_called_once()
|
rmdir_mock.assert_called_once()
|
||||||
|
|
||||||
assert hass.config_entries.async_entries() == []
|
assert hass.config_entries.async_entries() == []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user