1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +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

@@ -31,7 +31,7 @@ async def test_user(hass: HomeAssistant, test_api: Mock) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
assert result.get("type") == data_entry_flow.FlowResultType.FORM
assert result.get("step_id") == "user"
# test with all provided
@@ -40,7 +40,7 @@ async def test_user(hass: HomeAssistant, test_api: Mock) -> None:
context={"source": SOURCE_USER},
data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID},
)
assert result.get("type") == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result.get("title") == "solaredge_site_1_2_3"
data = result.get("data")
@@ -62,7 +62,7 @@ async def test_abort_if_already_setup(hass: HomeAssistant, test_api: str) -> Non
context={"source": SOURCE_USER},
data={CONF_NAME: "test", CONF_SITE_ID: SITE_ID, CONF_API_KEY: "test"},
)
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
assert result.get("type") == data_entry_flow.FlowResultType.FORM
assert result.get("errors") == {CONF_SITE_ID: "already_configured"}
@@ -82,7 +82,7 @@ async def test_ignored_entry_does_not_cause_error(
context={"source": SOURCE_USER},
data={CONF_NAME: "test", CONF_SITE_ID: SITE_ID, CONF_API_KEY: "test"},
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["title"] == "test"
data = result["data"]
@@ -102,7 +102,7 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None:
context={"source": SOURCE_USER},
data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID},
)
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
assert result.get("type") == data_entry_flow.FlowResultType.FORM
assert result.get("errors") == {CONF_SITE_ID: "site_not_active"}
# test with api_failure
@@ -112,7 +112,7 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None:
context={"source": SOURCE_USER},
data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID},
)
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
assert result.get("type") == data_entry_flow.FlowResultType.FORM
assert result.get("errors") == {CONF_SITE_ID: "invalid_api_key"}
# test with ConnectionTimeout
@@ -122,7 +122,7 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None:
context={"source": SOURCE_USER},
data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID},
)
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
assert result.get("type") == data_entry_flow.FlowResultType.FORM
assert result.get("errors") == {CONF_SITE_ID: "could_not_connect"}
# test with HTTPError
@@ -132,5 +132,5 @@ async def test_asserts(hass: HomeAssistant, test_api: Mock) -> None:
context={"source": SOURCE_USER},
data={CONF_NAME: NAME, CONF_API_KEY: API_KEY, CONF_SITE_ID: SITE_ID},
)
assert result.get("type") == data_entry_flow.RESULT_TYPE_FORM
assert result.get("type") == data_entry_flow.FlowResultType.FORM
assert result.get("errors") == {CONF_SITE_ID: "could_not_connect"}