mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix kitchen sink
This commit is contained in:
parent
bbba064acf
commit
1a2c59ffeb
@ -79,17 +79,20 @@ class OptionsFlowHandler(OptionsFlow):
|
||||
{
|
||||
vol.Optional(
|
||||
CONF_BOOLEAN,
|
||||
default=False,
|
||||
default=self.config_entry.options.get(
|
||||
"section_1", {}
|
||||
).get(CONF_BOOLEAN, False),
|
||||
): bool,
|
||||
vol.Optional(
|
||||
CONF_INT,
|
||||
default=10,
|
||||
self.config_entry.options.get("section_1", {}).get(
|
||||
CONF_INT, 10
|
||||
),
|
||||
): int,
|
||||
}
|
||||
),
|
||||
{
|
||||
"collapsed": False,
|
||||
"default": self.config_entry.options.get("section_1"),
|
||||
},
|
||||
),
|
||||
vol.Required("section_2"): data_entry_flow.section(
|
||||
@ -108,7 +111,7 @@ class OptionsFlowHandler(OptionsFlow):
|
||||
{
|
||||
"collapsed": False,
|
||||
"multiple": True,
|
||||
"default": self.config_entry.options.get("section_2"),
|
||||
"default": self.config_entry.options.get("section_2", []),
|
||||
},
|
||||
),
|
||||
}
|
||||
|
@ -98,9 +98,39 @@ async def test_options_flow(hass: HomeAssistant) -> None:
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"section_1": {"bool": True, "int": 15}},
|
||||
user_input={
|
||||
"section_1": {
|
||||
"bool": True,
|
||||
"int": 15,
|
||||
},
|
||||
"section_2": [
|
||||
{
|
||||
"a": 2,
|
||||
"b": 4,
|
||||
},
|
||||
{
|
||||
"a": 5,
|
||||
"b": 7,
|
||||
},
|
||||
],
|
||||
},
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {"section_1": {"bool": True, "int": 15}}
|
||||
assert config_entry.options == {
|
||||
"section_1": {
|
||||
"bool": True,
|
||||
"int": 15,
|
||||
},
|
||||
"section_2": [
|
||||
{
|
||||
"a": 2,
|
||||
"b": 4,
|
||||
},
|
||||
{
|
||||
"a": 5,
|
||||
"b": 7,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
Loading…
x
Reference in New Issue
Block a user