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

Write protect entity options (#90185)

This commit is contained in:
Erik Montnemery
2023-03-28 22:56:51 +02:00
committed by GitHub
parent 0550b17d54
commit e22618a555
5 changed files with 41 additions and 8 deletions

View File

@@ -747,6 +747,16 @@ async def test_update_entity_options(entity_registry: er.EntityRegistry) -> None
assert entry.options == {}
assert new_entry_1.options == {"light": {"minimum_brightness": 20}}
# Test it's not possible to modify the options
with pytest.raises(NotImplementedError):
new_entry_1.options["blah"] = {}
with pytest.raises(NotImplementedError):
new_entry_1.options["light"] = {}
with pytest.raises(TypeError):
new_entry_1.options["light"]["blah"] = 123
with pytest.raises(TypeError):
new_entry_1.options["light"]["minimum_brightness"] = 123
entity_registry.async_update_entity_options(
entry.entity_id, "light", {"minimum_brightness": 30}
)