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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
237 changed files with 2284 additions and 2280 deletions

View file

@ -47,7 +47,7 @@ async def test_full_flow(
},
)
assert result["type"] == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
assert result["step_id"] == "auth"
assert result["url"] == (
f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}"
@ -77,7 +77,7 @@ async def test_full_flow(
result = await hass.config_entries.flow.async_configure(result["flow_id"])
await hass.async_block_till_done()
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["title"] == "Home+ Control"
config_data = result["data"]
assert config_data["token"]["refresh_token"] == "mock-refresh-token"
@ -109,7 +109,7 @@ async def test_abort_if_entry_in_progress(hass, current_request_with_host):
result = await hass.config_entries.flow.async_init(
"home_plus_control", context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["reason"] == "already_in_progress"
@ -134,7 +134,7 @@ async def test_abort_if_entry_exists(hass, current_request_with_host):
result = await hass.config_entries.flow.async_init(
"home_plus_control", context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["reason"] == "single_instance_allowed"
@ -165,7 +165,7 @@ async def test_abort_if_invalid_token(
},
)
assert result["type"] == data_entry_flow.RESULT_TYPE_EXTERNAL_STEP
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
assert result["step_id"] == "auth"
assert result["url"] == (
f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}"
@ -189,5 +189,5 @@ async def test_abort_if_invalid_token(
)
result = await hass.config_entries.flow.async_configure(result["flow_id"])
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["reason"] == "oauth_error"