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

@ -4,7 +4,7 @@ from unittest.mock import patch
from homeassistant import config_entries
from homeassistant.components.mill.const import CLOUD, CONNECTION_TYPE, DOMAIN, LOCAL
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_USERNAME
from homeassistant.data_entry_flow import RESULT_TYPE_FORM
from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
@ -15,7 +15,7 @@ async def test_show_config_form(hass):
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["step_id"] == "user"
@ -24,7 +24,7 @@ async def test_create_entry(hass):
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
result2 = await hass.config_entries.flow.async_configure(
@ -33,7 +33,7 @@ async def test_create_entry(hass):
CONNECTION_TYPE: CLOUD,
},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
with patch("mill.Mill.connect", return_value=True):
result = await hass.config_entries.flow.async_configure(
@ -72,7 +72,7 @@ async def test_flow_entry_already_exists(hass):
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
result2 = await hass.config_entries.flow.async_configure(
@ -81,7 +81,7 @@ async def test_flow_entry_already_exists(hass):
CONNECTION_TYPE: CLOUD,
},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
with patch("mill.Mill.connect", return_value=True):
result = await hass.config_entries.flow.async_configure(
@ -99,7 +99,7 @@ async def test_connection_error(hass):
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
result2 = await hass.config_entries.flow.async_configure(
@ -108,7 +108,7 @@ async def test_connection_error(hass):
CONNECTION_TYPE: CLOUD,
},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
with patch("mill.Mill.connect", return_value=False):
result = await hass.config_entries.flow.async_configure(
@ -119,7 +119,7 @@ async def test_connection_error(hass):
},
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] == {"base": "cannot_connect"}
@ -128,7 +128,7 @@ async def test_local_create_entry(hass):
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
result2 = await hass.config_entries.flow.async_configure(
@ -137,7 +137,7 @@ async def test_local_create_entry(hass):
CONNECTION_TYPE: LOCAL,
},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
test_data = {
CONF_IP_ADDRESS: "192.168.1.59",
@ -180,7 +180,7 @@ async def test_local_flow_entry_already_exists(hass):
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
result2 = await hass.config_entries.flow.async_configure(
@ -189,7 +189,7 @@ async def test_local_flow_entry_already_exists(hass):
CONNECTION_TYPE: LOCAL,
},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
test_data = {
CONF_IP_ADDRESS: "192.168.1.59",
@ -219,7 +219,7 @@ async def test_local_connection_error(hass):
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
result2 = await hass.config_entries.flow.async_configure(
@ -228,7 +228,7 @@ async def test_local_connection_error(hass):
CONNECTION_TYPE: LOCAL,
},
)
assert result2["type"] == RESULT_TYPE_FORM
assert result2["type"] == FlowResultType.FORM
test_data = {
CONF_IP_ADDRESS: "192.168.1.59",
@ -243,5 +243,5 @@ async def test_local_connection_error(hass):
test_data,
)
assert result["type"] == RESULT_TYPE_FORM
assert result["type"] == FlowResultType.FORM
assert result["errors"] == {"base": "cannot_connect"}