Search/replace RESULT_TYPE_* by FlowResultType enum (#74656)
This commit is contained in:
parent
46beae9061
commit
a6244eea28
142 changed files with 1463 additions and 1849 deletions
|
@ -11,11 +11,7 @@ from homeassistant.components import zeroconf
|
|||
from homeassistant.components.daikin.const import KEY_MAC
|
||||
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
|
||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PASSWORD
|
||||
from homeassistant.data_entry_flow import (
|
||||
RESULT_TYPE_ABORT,
|
||||
RESULT_TYPE_CREATE_ENTRY,
|
||||
RESULT_TYPE_FORM,
|
||||
)
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -54,7 +50,7 @@ async def test_user(hass, mock_daikin):
|
|||
context={"source": SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -62,7 +58,7 @@ async def test_user(hass, mock_daikin):
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == HOST
|
||||
assert result["data"][CONF_HOST] == HOST
|
||||
assert result["data"][KEY_MAC] == MAC
|
||||
|
@ -77,7 +73,7 @@ async def test_abort_if_already_setup(hass, mock_daikin):
|
|||
data={CONF_HOST: HOST, KEY_MAC: MAC},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -100,7 +96,7 @@ async def test_device_abort(hass, mock_daikin, s_effect, reason):
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, KEY_MAC: MAC},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": reason}
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
@ -112,7 +108,7 @@ async def test_api_password_abort(hass):
|
|||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, CONF_API_KEY: "aa", CONF_PASSWORD: "aa"},
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "api_password"}
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
@ -144,7 +140,7 @@ async def test_discovery_zeroconf(
|
|||
context={"source": source},
|
||||
data=data,
|
||||
)
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
MockConfigEntry(domain="daikin", unique_id=unique_id).add_to_hass(hass)
|
||||
|
@ -154,7 +150,7 @@ async def test_discovery_zeroconf(
|
|||
data={CONF_HOST: HOST},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
@ -163,5 +159,5 @@ async def test_discovery_zeroconf(
|
|||
data=data,
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_in_progress"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue