mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Fix kitchen sink
This commit is contained in:
parent
bbba064acf
commit
1a2c59ffeb
@ -79,17 +79,20 @@ class OptionsFlowHandler(OptionsFlow):
|
|||||||
{
|
{
|
||||||
vol.Optional(
|
vol.Optional(
|
||||||
CONF_BOOLEAN,
|
CONF_BOOLEAN,
|
||||||
default=False,
|
default=self.config_entry.options.get(
|
||||||
|
"section_1", {}
|
||||||
|
).get(CONF_BOOLEAN, False),
|
||||||
): bool,
|
): bool,
|
||||||
vol.Optional(
|
vol.Optional(
|
||||||
CONF_INT,
|
CONF_INT,
|
||||||
default=10,
|
self.config_entry.options.get("section_1", {}).get(
|
||||||
|
CONF_INT, 10
|
||||||
|
),
|
||||||
): int,
|
): int,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
"collapsed": False,
|
"collapsed": False,
|
||||||
"default": self.config_entry.options.get("section_1"),
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
vol.Required("section_2"): data_entry_flow.section(
|
vol.Required("section_2"): data_entry_flow.section(
|
||||||
@ -108,7 +111,7 @@ class OptionsFlowHandler(OptionsFlow):
|
|||||||
{
|
{
|
||||||
"collapsed": False,
|
"collapsed": False,
|
||||||
"multiple": True,
|
"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 = await hass.config_entries.options.async_configure(
|
||||||
result["flow_id"],
|
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 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()
|
await hass.async_block_till_done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user