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:
@@ -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}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user