1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add a guard to handle unhashable platforms in config (#113607)

Someone might set the platform to [fitbit] instead of fitbit

I have not seen anyone do this, but its good to guard against
it
This commit is contained in:
J. Nick Koston
2024-03-16 10:19:07 -10:00
committed by GitHub
parent 5dccd8204c
commit 4174d88ad7
2 changed files with 4 additions and 2 deletions

View File

@@ -2348,6 +2348,7 @@ def test_extract_platform_integrations() -> None:
[
(b"zone", {"platform": "not str"}),
("zone", {"platform": "hello"}),
("switch", {"platform": ["un", "hash", "able"]}),
("zonex", []),
("zoney", ""),
("notzone", {"platform": "nothello"}),
@@ -2363,6 +2364,7 @@ def test_extract_platform_integrations() -> None:
assert config_util.extract_platform_integrations(config, {"zone"}) == {
"zone": {"hello", "hello 2"}
}
assert config_util.extract_platform_integrations(config, {"switch"}) == {}
assert config_util.extract_platform_integrations(config, {"zonex"}) == {}
assert config_util.extract_platform_integrations(config, {"zoney"}) == {}
assert config_util.extract_platform_integrations(