1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

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
142 changed files with 1463 additions and 1849 deletions

View File

@@ -6,11 +6,7 @@ import aiohttp
from homeassistant import config_entries
from homeassistant.components.opengarage.const import DOMAIN
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 tests.common import MockConfigEntry
@@ -21,7 +17,7 @@ async def test_form(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] is None
with patch(
@@ -37,7 +33,7 @@ async def test_form(hass: HomeAssistant) -> None:
)
await hass.async_block_till_done()
assert result2["type"] == RESULT_TYPE_CREATE_ENTRY
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["title"] == "Name of the device"
assert result2["data"] == {
"host": "http://1.1.1.1",
@@ -63,7 +59,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
{"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
assert result2["errors"] == {"base": "invalid_auth"}
@@ -82,7 +78,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
{"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
assert result2["errors"] == {"base": "cannot_connect"}
@@ -101,7 +97,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None:
{"host": "http://1.1.1.1", "device_key": "AfsasdnfkjDD"},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
assert result2["errors"] == {"base": "unknown"}
@@ -132,5 +128,5 @@ async def test_flow_entry_already_exists(hass: HomeAssistant) -> None:
},
)
assert result["type"] == RESULT_TYPE_ABORT
assert result["type"] == FlowResultType.ABORT
assert result["reason"] == "already_configured"