|
@@ -41,14 +41,15 @@ async def _options_init(hass: HomeAssistant, mock_entry):
|
|
|
"""Start an options flow; returns the init-step result."""
|
|
"""Start an options flow; returns the init-step result."""
|
|
|
mock_entry.add_to_hass(hass)
|
|
mock_entry.add_to_hass(hass)
|
|
|
result = await hass.config_entries.options.async_init(mock_entry.entry_id)
|
|
result = await hass.config_entries.options.async_init(mock_entry.entry_id)
|
|
|
|
|
+ assert result["type"] == "menu"
|
|
|
assert result["step_id"] == "init"
|
|
assert result["step_id"] == "init"
|
|
|
return result
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
-async def _select_section(hass: HomeAssistant, flow_id: str, section: str):
|
|
|
|
|
|
|
+async def _select_section(hass: HomeAssistant, flow_id: str, step_id: str):
|
|
|
"""Choose a section from the init menu."""
|
|
"""Choose a section from the init menu."""
|
|
|
return await hass.config_entries.options.async_configure(
|
|
return await hass.config_entries.options.async_configure(
|
|
|
- flow_id, user_input={"section": section}
|
|
|
|
|
|
|
+ flow_id, user_input={"next_step_id": step_id}
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -87,15 +88,15 @@ async def test_user_step_creates_entry_with_room_name(hass: HomeAssistant):
|
|
|
# Options flow — init (menu) step
|
|
# Options flow — init (menu) step
|
|
|
# ---------------------------------------------------------------------------
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-async def test_options_init_shows_form(hass: HomeAssistant, mock_entry):
|
|
|
|
|
|
|
+async def test_options_init_shows_menu(hass: HomeAssistant, mock_entry):
|
|
|
result = await _options_init(hass, mock_entry)
|
|
result = await _options_init(hass, mock_entry)
|
|
|
- assert result["type"] == "form"
|
|
|
|
|
|
|
+ assert result["type"] == "menu"
|
|
|
assert result["step_id"] == "init"
|
|
assert result["step_id"] == "init"
|
|
|
|
|
|
|
|
|
|
|
|
|
async def test_options_init_sync_leads_to_sync_mode(hass: HomeAssistant, mock_entry):
|
|
async def test_options_init_sync_leads_to_sync_mode(hass: HomeAssistant, mock_entry):
|
|
|
result = await _options_init(hass, mock_entry)
|
|
result = await _options_init(hass, mock_entry)
|
|
|
- result = await _select_section(hass, result["flow_id"], "sync")
|
|
|
|
|
|
|
+ result = await _select_section(hass, result["flow_id"], "sync_mode")
|
|
|
assert result["type"] == "form"
|
|
assert result["type"] == "form"
|
|
|
assert result["step_id"] == "sync_mode"
|
|
assert result["step_id"] == "sync_mode"
|
|
|
|
|
|
|
@@ -120,7 +121,7 @@ async def test_options_init_locks_leads_to_locks(hass: HomeAssistant, mock_entry
|
|
|
|
|
|
|
|
async def test_options_sync_mode_manual_saves(hass: HomeAssistant, mock_entry):
|
|
async def test_options_sync_mode_manual_saves(hass: HomeAssistant, mock_entry):
|
|
|
result = await _options_init(hass, mock_entry)
|
|
result = await _options_init(hass, mock_entry)
|
|
|
- result = await _select_section(hass, result["flow_id"], "sync")
|
|
|
|
|
|
|
+ result = await _select_section(hass, result["flow_id"], "sync_mode")
|
|
|
assert result["step_id"] == "sync_mode"
|
|
assert result["step_id"] == "sync_mode"
|
|
|
|
|
|
|
|
result = await hass.config_entries.options.async_configure(
|
|
result = await hass.config_entries.options.async_configure(
|
|
@@ -133,7 +134,7 @@ async def test_options_sync_mode_manual_saves(hass: HomeAssistant, mock_entry):
|
|
|
|
|
|
|
|
async def test_options_sync_mode_caldav_proceeds_to_caldav_step(hass: HomeAssistant, mock_entry):
|
|
async def test_options_sync_mode_caldav_proceeds_to_caldav_step(hass: HomeAssistant, mock_entry):
|
|
|
result = await _options_init(hass, mock_entry)
|
|
result = await _options_init(hass, mock_entry)
|
|
|
- result = await _select_section(hass, result["flow_id"], "sync")
|
|
|
|
|
|
|
+ result = await _select_section(hass, result["flow_id"], "sync_mode")
|
|
|
result = await hass.config_entries.options.async_configure(
|
|
result = await hass.config_entries.options.async_configure(
|
|
|
result["flow_id"],
|
|
result["flow_id"],
|
|
|
user_input={CONF_SYNC_MODE: SYNC_MODE_CALDAV},
|
|
user_input={CONF_SYNC_MODE: SYNC_MODE_CALDAV},
|
|
@@ -144,7 +145,7 @@ async def test_options_sync_mode_caldav_proceeds_to_caldav_step(hass: HomeAssist
|
|
|
|
|
|
|
|
async def test_options_sync_mode_api_proceeds_to_api_step(hass: HomeAssistant, mock_entry):
|
|
async def test_options_sync_mode_api_proceeds_to_api_step(hass: HomeAssistant, mock_entry):
|
|
|
result = await _options_init(hass, mock_entry)
|
|
result = await _options_init(hass, mock_entry)
|
|
|
- result = await _select_section(hass, result["flow_id"], "sync")
|
|
|
|
|
|
|
+ result = await _select_section(hass, result["flow_id"], "sync_mode")
|
|
|
result = await hass.config_entries.options.async_configure(
|
|
result = await hass.config_entries.options.async_configure(
|
|
|
result["flow_id"],
|
|
result["flow_id"],
|
|
|
user_input={CONF_SYNC_MODE: SYNC_MODE_API},
|
|
user_input={CONF_SYNC_MODE: SYNC_MODE_API},
|
|
@@ -159,7 +160,7 @@ async def test_options_sync_mode_api_proceeds_to_api_step(hass: HomeAssistant, m
|
|
|
|
|
|
|
|
async def _reach_caldav_step(hass: HomeAssistant, mock_entry):
|
|
async def _reach_caldav_step(hass: HomeAssistant, mock_entry):
|
|
|
result = await _options_init(hass, mock_entry)
|
|
result = await _options_init(hass, mock_entry)
|
|
|
- result = await _select_section(hass, result["flow_id"], "sync")
|
|
|
|
|
|
|
+ result = await _select_section(hass, result["flow_id"], "sync_mode")
|
|
|
result = await hass.config_entries.options.async_configure(
|
|
result = await hass.config_entries.options.async_configure(
|
|
|
result["flow_id"], user_input={CONF_SYNC_MODE: SYNC_MODE_CALDAV}
|
|
result["flow_id"], user_input={CONF_SYNC_MODE: SYNC_MODE_CALDAV}
|
|
|
)
|
|
)
|
|
@@ -238,7 +239,7 @@ async def test_options_caldav_connect_error_shows_error(hass: HomeAssistant, moc
|
|
|
|
|
|
|
|
async def _reach_api_step(hass: HomeAssistant, mock_entry):
|
|
async def _reach_api_step(hass: HomeAssistant, mock_entry):
|
|
|
result = await _options_init(hass, mock_entry)
|
|
result = await _options_init(hass, mock_entry)
|
|
|
- result = await _select_section(hass, result["flow_id"], "sync")
|
|
|
|
|
|
|
+ result = await _select_section(hass, result["flow_id"], "sync_mode")
|
|
|
result = await hass.config_entries.options.async_configure(
|
|
result = await hass.config_entries.options.async_configure(
|
|
|
result["flow_id"], user_input={CONF_SYNC_MODE: SYNC_MODE_API}
|
|
result["flow_id"], user_input={CONF_SYNC_MODE: SYNC_MODE_API}
|
|
|
)
|
|
)
|