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

This commit is contained in:
Franck Nijhof 2022-07-07 21:28:18 +02:00 committed by GitHub
parent 46beae9061
commit a6244eea28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
142 changed files with 1463 additions and 1849 deletions

View file

@ -6,11 +6,7 @@ from homeassistant.components.laundrify.const import DOMAIN
from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_CODE, CONF_SOURCE
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import (
RESULT_TYPE_ABORT,
RESULT_TYPE_CREATE_ENTRY,
RESULT_TYPE_FORM,
)
from homeassistant.data_entry_flow import FlowResultType
from . import create_entry
from .const import VALID_ACCESS_TOKEN, VALID_AUTH_CODE, VALID_USER_INPUT
@ -21,7 +17,7 @@ async def test_form(hass: HomeAssistant, laundrify_setup_entry) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] is None
result = await hass.config_entries.flow.async_configure(
@ -30,7 +26,7 @@ async def test_form(hass: HomeAssistant, laundrify_setup_entry) -> None:
)
await hass.async_block_till_done()
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["title"] == DOMAIN
assert result["data"] == {
CONF_ACCESS_TOKEN: VALID_ACCESS_TOKEN,
@ -50,7 +46,7 @@ async def test_form_invalid_format(
data={CONF_CODE: "invalidFormat"},
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] == {CONF_CODE: "invalid_format"}
@ -63,7 +59,7 @@ async def test_form_invalid_auth(hass: HomeAssistant, laundrify_exchange_code) -
data=VALID_USER_INPUT,
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] == {CONF_CODE: "invalid_auth"}
@ -76,7 +72,7 @@ async def test_form_cannot_connect(hass: HomeAssistant, laundrify_exchange_code)
data=VALID_USER_INPUT,
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] == {"base": "cannot_connect"}
@ -89,7 +85,7 @@ async def test_form_unkown_exception(hass: HomeAssistant, laundrify_exchange_cod
data=VALID_USER_INPUT,
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] == {"base": "unknown"}
@ -99,7 +95,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None:
DOMAIN, context={"source": SOURCE_REAUTH}
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] is None
result = await hass.config_entries.flow.async_configure(
@ -108,7 +104,7 @@ async def test_step_reauth(hass: HomeAssistant) -> None:
)
await hass.async_block_till_done()
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
async def test_integration_already_exists(hass: HomeAssistant):
@ -125,5 +121,5 @@ async def test_integration_already_exists(hass: HomeAssistant):
},
)
assert result["type"] == RESULT_TYPE_ABORT
assert result["type"] == FlowResultType.ABORT
assert result["reason"] == "already_configured"