From 2f1824774f63302a3b902a34847d3831f22bc698 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 16 Mar 2020 20:08:00 +0100 Subject: [PATCH] Lovelace: storage key based on id instead of url_path (#32873) * Fix storage key based on url_path * Fix test --- homeassistant/components/lovelace/dashboard.py | 2 +- tests/components/lovelace/test_dashboard.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/lovelace/dashboard.py b/homeassistant/components/lovelace/dashboard.py index 38740672914..cdb104a150b 100644 --- a/homeassistant/components/lovelace/dashboard.py +++ b/homeassistant/components/lovelace/dashboard.py @@ -88,7 +88,7 @@ class LovelaceStorage(LovelaceConfig): storage_key = CONFIG_STORAGE_KEY_DEFAULT else: url_path = config[CONF_URL_PATH] - storage_key = CONFIG_STORAGE_KEY.format(url_path) + storage_key = CONFIG_STORAGE_KEY.format(config["id"]) super().__init__(hass, url_path, config) diff --git a/tests/components/lovelace/test_dashboard.py b/tests/components/lovelace/test_dashboard.py index 1effb10be27..775b2760c96 100644 --- a/tests/components/lovelace/test_dashboard.py +++ b/tests/components/lovelace/test_dashboard.py @@ -373,7 +373,6 @@ async def test_storage_dashboards(hass, hass_ws_client, hass_storage): assert response["result"]["icon"] == "mdi:map" dashboard_id = response["result"]["id"] - dashboard_path = response["result"]["url_path"] assert "created-url-path" in hass.data[frontend.DATA_PANELS] @@ -408,9 +407,9 @@ async def test_storage_dashboards(hass, hass_ws_client, hass_storage): ) response = await client.receive_json() assert response["success"] - assert hass_storage[dashboard.CONFIG_STORAGE_KEY.format(dashboard_path)][ - "data" - ] == {"config": {"yo": "hello"}} + assert hass_storage[dashboard.CONFIG_STORAGE_KEY.format(dashboard_id)]["data"] == { + "config": {"yo": "hello"} + } assert len(events) == 1 assert events[0].data["url_path"] == "created-url-path"