mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add visual image preview during generic camera options flow (#80392)
Co-authored-by: Dave T <davet2001@users.noreply.github.com>
This commit is contained in:
@@ -596,7 +596,13 @@ async def test_options_template_error(hass, fakeimgbytes_png, mock_create_stream
|
||||
result["flow_id"],
|
||||
user_input=data,
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "confirm_still"
|
||||
|
||||
result2a = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"], user_input={CONF_CONFIRMED_OK: True}
|
||||
)
|
||||
assert result2a["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
result3 = await hass.config_entries.options.async_init(mock_entry.entry_id)
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
@@ -681,10 +687,16 @@ async def test_options_only_stream(hass, fakeimgbytes_png, mock_create_stream):
|
||||
|
||||
# try updating the config options
|
||||
with mock_create_stream:
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input=data,
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result2["step_id"] == "confirm_still"
|
||||
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"], user_input={CONF_CONFIRMED_OK: True}
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result3["data"][CONF_CONTENT_TYPE] == "image/jpeg"
|
||||
|
||||
@@ -809,4 +821,24 @@ async def test_use_wallclock_as_timestamps_option(
|
||||
result["flow_id"],
|
||||
user_input={CONF_USE_WALLCLOCK_AS_TIMESTAMPS: True, **TESTDATA},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||
# Test what happens if user rejects the preview
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"], user_input={CONF_CONFIRMED_OK: False}
|
||||
)
|
||||
assert result3["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result3["step_id"] == "init"
|
||||
with patch(
|
||||
"homeassistant.components.generic.async_setup_entry", return_value=True
|
||||
), mock_create_stream:
|
||||
result4 = await hass.config_entries.options.async_configure(
|
||||
result3["flow_id"],
|
||||
user_input={CONF_USE_WALLCLOCK_AS_TIMESTAMPS: True, **TESTDATA},
|
||||
)
|
||||
assert result4["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result4["step_id"] == "confirm_still"
|
||||
result5 = await hass.config_entries.options.async_configure(
|
||||
result4["flow_id"],
|
||||
user_input={CONF_CONFIRMED_OK: True},
|
||||
)
|
||||
assert result5["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
|
||||
Reference in New Issue
Block a user