1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-27 14:31:13 +00:00

Search/replace RESULT_TYPE_* by FlowResultType enum (#74642)

This commit is contained in:
Franck Nijhof
2022-07-07 18:57:36 +02:00
committed by GitHub
parent 68ccb96089
commit 7cd68381f1
237 changed files with 2284 additions and 2280 deletions

View File

@@ -73,7 +73,7 @@ async def test_flow_discovered_devices(hass):
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"
with patch(
@@ -91,7 +91,7 @@ async def test_flow_discovered_devices(hass):
result["flow_id"], user_input={"auto": True}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "device"
assert len(result["data_schema"].schema[config_flow.CONF_HOST].container) == 3
@@ -99,7 +99,7 @@ async def test_flow_discovered_devices(hass):
result["flow_id"], user_input={config_flow.CONF_HOST: f"{URN} ({HOST})"}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "configure"
with patch(
@@ -116,7 +116,7 @@ async def test_flow_discovered_devices(hass):
await hass.async_block_till_done()
assert len(mock_setup_entry.mock_calls) == 1
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["title"] == f"{URN} - {MAC}"
assert result["data"] == {
config_flow.CONF_NAME: URN,
@@ -135,7 +135,7 @@ async def test_flow_discovered_devices_ignore_configured_manual_input(hass):
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"
with patch(
@@ -153,7 +153,7 @@ async def test_flow_discovered_devices_ignore_configured_manual_input(hass):
result["flow_id"], user_input={"auto": True}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "device"
assert len(result["data_schema"].schema[config_flow.CONF_HOST].container) == 2
@@ -162,7 +162,7 @@ async def test_flow_discovered_devices_ignore_configured_manual_input(hass):
user_input={config_flow.CONF_HOST: config_flow.CONF_MANUAL_INPUT},
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "configure"
@@ -174,7 +174,7 @@ async def test_flow_discovered_no_device(hass):
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"
with patch(
@@ -192,7 +192,7 @@ async def test_flow_discovered_no_device(hass):
result["flow_id"], user_input={"auto": True}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "configure"
@@ -216,7 +216,7 @@ async def test_flow_discovery_ignore_existing_and_abort(hass):
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"
with patch(
@@ -235,7 +235,7 @@ async def test_flow_discovery_ignore_existing_and_abort(hass):
)
# It should skip to manual entry if the only devices are already configured
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "configure"
result = await hass.config_entries.flow.async_configure(
@@ -250,7 +250,7 @@ async def test_flow_discovery_ignore_existing_and_abort(hass):
)
# It should abort if already configured and entered manually
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["type"] == data_entry_flow.FlowResultType.ABORT
async def test_flow_manual_entry(hass):
@@ -259,7 +259,7 @@ async def test_flow_manual_entry(hass):
config_flow.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"
with patch(
@@ -279,7 +279,7 @@ async def test_flow_manual_entry(hass):
user_input={"auto": False},
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "configure"
with patch(
@@ -299,7 +299,7 @@ async def test_flow_manual_entry(hass):
await hass.async_block_till_done()
assert len(mock_setup_entry.mock_calls) == 1
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["title"] == f"{NAME} - {MAC}"
assert result["data"] == {
config_flow.CONF_NAME: NAME,
@@ -318,7 +318,7 @@ async def test_option_flow(hass):
entry.entry_id, context={"show_advanced_options": True}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "onvif_devices"
result = await hass.config_entries.options.async_configure(
@@ -330,7 +330,7 @@ async def test_option_flow(hass):
},
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["data"] == {
config_flow.CONF_EXTRA_ARGUMENTS: "",
config_flow.CONF_RTSP_TRANSPORT: list(config_flow.RTSP_TRANSPORTS)[1],