From 9eea7864116808b93ee3406d0415512e58d68cdd Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 14 Mar 2024 10:43:55 +0100 Subject: [PATCH] Remove old migration from lovelace (#113388) --- .../components/lovelace/dashboard.py | 17 ------ tests/components/lovelace/test_dashboard.py | 55 ------------------- 2 files changed, 72 deletions(-) diff --git a/homeassistant/components/lovelace/dashboard.py b/homeassistant/components/lovelace/dashboard.py index 984c0d14734..98c03e20d87 100644 --- a/homeassistant/components/lovelace/dashboard.py +++ b/homeassistant/components/lovelace/dashboard.py @@ -232,23 +232,6 @@ class DashboardsCollection(collection.DictStorageCollection): storage.Store(hass, DASHBOARDS_STORAGE_VERSION, DASHBOARDS_STORAGE_KEY), ) - async def _async_load_data(self) -> collection.SerializedStorageCollection | None: - """Load the data.""" - if (data := await self.store.async_load()) is None: - return data - - updated = False - - for item in data["items"] or []: - if "-" not in item[CONF_URL_PATH]: - updated = True - item[CONF_URL_PATH] = f"lovelace-{item[CONF_URL_PATH]}" - - if updated: - await self.store.async_save(data) - - return data - async def _process_create_data(self, data: dict) -> dict: """Validate the config is valid.""" if "-" not in data[CONF_URL_PATH]: diff --git a/tests/components/lovelace/test_dashboard.py b/tests/components/lovelace/test_dashboard.py index 0fca21a9a45..a85770d8ae4 100644 --- a/tests/components/lovelace/test_dashboard.py +++ b/tests/components/lovelace/test_dashboard.py @@ -441,61 +441,6 @@ async def test_storage_dashboards( assert dashboard.CONFIG_STORAGE_KEY.format(dashboard_id) not in hass_storage -async def test_storage_dashboard_migrate( - hass: HomeAssistant, hass_ws_client, hass_storage: dict[str, Any] -) -> None: - """Test changing url path from storage config.""" - hass_storage[dashboard.DASHBOARDS_STORAGE_KEY] = { - "key": "lovelace_dashboards", - "version": 1, - "data": { - "items": [ - { - "icon": "mdi:tools", - "id": "tools", - "mode": "storage", - "require_admin": True, - "show_in_sidebar": True, - "title": "Tools", - "url_path": "tools", - }, - { - "icon": "mdi:tools", - "id": "tools2", - "mode": "storage", - "require_admin": True, - "show_in_sidebar": True, - "title": "Tools", - "url_path": "dashboard-tools", - }, - ] - }, - } - - assert await async_setup_component(hass, "lovelace", {}) - - client = await hass_ws_client(hass) - - # Fetch data - await client.send_json({"id": 5, "type": "lovelace/dashboards/list"}) - response = await client.receive_json() - assert response["success"] - without_hyphen, with_hyphen = response["result"] - - assert without_hyphen["icon"] == "mdi:tools" - assert without_hyphen["id"] == "tools" - assert without_hyphen["mode"] == "storage" - assert without_hyphen["require_admin"] - assert without_hyphen["show_in_sidebar"] - assert without_hyphen["title"] == "Tools" - assert without_hyphen["url_path"] == "lovelace-tools" - - assert ( - with_hyphen - == hass_storage[dashboard.DASHBOARDS_STORAGE_KEY]["data"]["items"][1] - ) - - async def test_websocket_list_dashboards( hass: HomeAssistant, hass_ws_client: WebSocketGenerator ) -> None: