mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Fix MotionEye config flow (#64360)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
d3374ecd8e
commit
65ea54927d
@ -222,17 +222,15 @@ class MotionEyeOptionsFlow(OptionsFlow):
|
|||||||
|
|
||||||
if self.show_advanced_options:
|
if self.show_advanced_options:
|
||||||
# The input URL is not validated as being a URL, to allow for the possibility
|
# The input URL is not validated as being a URL, to allow for the possibility
|
||||||
# the template input won't be a valid URL until after it's rendered.
|
# the template input won't be a valid URL until after it's rendered
|
||||||
schema.update(
|
stream_kwargs = {}
|
||||||
{
|
if CONF_STREAM_URL_TEMPLATE in self._config_entry.options:
|
||||||
vol.Required(
|
stream_kwargs["description"] = {
|
||||||
CONF_STREAM_URL_TEMPLATE,
|
"suggested_value": self._config_entry.options[
|
||||||
default=self._config_entry.options.get(
|
CONF_STREAM_URL_TEMPLATE
|
||||||
CONF_STREAM_URL_TEMPLATE,
|
]
|
||||||
"",
|
|
||||||
),
|
|
||||||
): str
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
schema[vol.Optional(CONF_STREAM_URL_TEMPLATE, **stream_kwargs)] = str
|
||||||
|
|
||||||
return self.async_show_form(step_id="init", data_schema=vol.Schema(schema))
|
return self.async_show_form(step_id="init", data_schema=vol.Schema(schema))
|
||||||
|
@ -480,6 +480,24 @@ async def test_advanced_options(hass: HomeAssistant) -> None:
|
|||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
result = await hass.config_entries.options.async_init(
|
||||||
|
config_entry.entry_id, context={"show_advanced_options": True}
|
||||||
|
)
|
||||||
|
result = await hass.config_entries.options.async_configure(
|
||||||
|
result["flow_id"],
|
||||||
|
user_input={
|
||||||
|
CONF_WEBHOOK_SET: True,
|
||||||
|
CONF_WEBHOOK_SET_OVERWRITE: True,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
|
assert result["data"][CONF_WEBHOOK_SET]
|
||||||
|
assert result["data"][CONF_WEBHOOK_SET_OVERWRITE]
|
||||||
|
assert CONF_STREAM_URL_TEMPLATE not in result["data"]
|
||||||
|
assert len(mock_setup.mock_calls) == 0
|
||||||
|
assert len(mock_setup_entry.mock_calls) == 0
|
||||||
|
|
||||||
result = await hass.config_entries.options.async_init(
|
result = await hass.config_entries.options.async_init(
|
||||||
config_entry.entry_id, context={"show_advanced_options": True}
|
config_entry.entry_id, context={"show_advanced_options": True}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user