From 510e90803e52b918132825d769cad574835d8ca0 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 5 Oct 2020 22:09:47 +0200 Subject: [PATCH] Exclude media_dirs from YAML config check (#41299) --- homeassistant/config.py | 1 - tests/test_config.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/homeassistant/config.py b/homeassistant/config.py index 8f9dc7c3d62..3e9dd27458d 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -488,7 +488,6 @@ async def async_process_ha_core_config(hass: HomeAssistant, config: Dict) -> Non CONF_UNIT_SYSTEM, CONF_EXTERNAL_URL, CONF_INTERNAL_URL, - CONF_MEDIA_DIRS, ] ): hac.config_source = SOURCE_YAML diff --git a/tests/test_config.py b/tests/test_config.py index fb22ee1118e..181e80da30c 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -369,6 +369,36 @@ async def test_loading_configuration_from_storage(hass, hass_storage): assert hass.config.config_source == SOURCE_STORAGE +async def test_loading_configuration_from_storage_with_yaml_only(hass, hass_storage): + """Test loading core and YAML config onto hass object.""" + hass_storage["core.config"] = { + "data": { + "elevation": 10, + "latitude": 55, + "location_name": "Home", + "longitude": 13, + "time_zone": "Europe/Copenhagen", + "unit_system": "metric", + }, + "key": "core.config", + "version": 1, + } + await config_util.async_process_ha_core_config( + hass, {"media_dirs": {"mymedia": "/usr"}, "allowlist_external_dirs": "/etc"} + ) + + assert hass.config.latitude == 55 + assert hass.config.longitude == 13 + assert hass.config.elevation == 10 + assert hass.config.location_name == "Home" + assert hass.config.units.name == CONF_UNIT_SYSTEM_METRIC + assert hass.config.time_zone.zone == "Europe/Copenhagen" + assert len(hass.config.allowlist_external_dirs) == 3 + assert "/etc" in hass.config.allowlist_external_dirs + assert hass.config.media_dirs == {"mymedia": "/usr"} + assert hass.config.config_source == SOURCE_STORAGE + + async def test_updating_configuration(hass, hass_storage): """Test updating configuration stores the new configuration.""" core_data = {