Avoid json encoder default fallback when serializing config (#108360)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
3184d3b168
commit
52b5d2e370
5 changed files with 37 additions and 33 deletions
|
@ -254,16 +254,20 @@ async def test_api_get_config(hass: HomeAssistant, mock_api_client: TestClient)
|
|||
"""Test the return of the configuration."""
|
||||
resp = await mock_api_client.get(const.URL_API_CONFIG)
|
||||
result = await resp.json()
|
||||
if "components" in result:
|
||||
result["components"] = set(result["components"])
|
||||
if "whitelist_external_dirs" in result:
|
||||
result["whitelist_external_dirs"] = set(result["whitelist_external_dirs"])
|
||||
if "allowlist_external_dirs" in result:
|
||||
result["allowlist_external_dirs"] = set(result["allowlist_external_dirs"])
|
||||
if "allowlist_external_urls" in result:
|
||||
result["allowlist_external_urls"] = set(result["allowlist_external_urls"])
|
||||
ignore_order_keys = (
|
||||
"components",
|
||||
"allowlist_external_dirs",
|
||||
"whitelist_external_dirs",
|
||||
"allowlist_external_urls",
|
||||
)
|
||||
config = hass.config.as_dict()
|
||||
|
||||
assert hass.config.as_dict() == result
|
||||
for key in ignore_order_keys:
|
||||
if key in result:
|
||||
result[key] = set(result[key])
|
||||
config[key] = set(config[key])
|
||||
|
||||
assert result == config
|
||||
|
||||
|
||||
async def test_api_get_components(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue