Reject an unknown publish= value

This commit is contained in:
J. Nick Koston
2026-10-16 11:45:47 -10:00
parent d0427c36eb
commit 05a4b256db
2 changed files with 8 additions and 0 deletions
+2
View File
@@ -559,6 +559,8 @@ class SubEntities:
raise ValueError(f"{entity_id}: apply= needs a parent")
if publish is not None and (apply is None or self.apply_entity.publish is None):
raise ValueError(f"{entity_id}: publish= needs apply= on a stateful domain")
if publish not in (None, "before", "after"):
raise ValueError(f'{entity_id}: publish= must be "before" or "after"')
if apply is None:
var = await self.new_entity(conf, *args, **kwargs)
@@ -1458,6 +1458,12 @@ async def test_sub_entities_apply_parent_id(
{"publish": "before"},
"publish= needs",
),
(
_SWITCH_APPLY,
_apply_conf("k_id"),
{"apply": "x()", "publish": "Before"},
"must be",
),
],
)
async def test_sub_entities_apply_errors(