Prevent nesting sections in data entry flows (#124645)

This commit is contained in:
Erik Montnemery
2024-08-28 15:42:15 +02:00
committed by GitHub
parent e39b3796f3
commit 174f22aa2f
2 changed files with 35 additions and 1 deletions

View File

@@ -1098,3 +1098,27 @@ def test_section_in_serializer() -> None:
],
"type": "expandable",
}
def test_nested_section_in_serializer() -> None:
"""Test section with custom_serializer."""
with pytest.raises(
ValueError, match="Nesting expandable sections is not supported"
):
cv.custom_serializer(
data_entry_flow.section(
vol.Schema(
{
vol.Required("section_1"): data_entry_flow.section(
vol.Schema(
{
vol.Optional("option_1", default=False): bool,
vol.Required("option_2"): int,
}
)
)
}
),
{"collapsed": False},
)
)