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

Use FlowResultType enum in config flow tests A-M (#114681)

This commit is contained in:
Joost Lekkerkerker
2024-04-03 09:21:17 +02:00
committed by GitHub
parent a767530970
commit b9281327c4
111 changed files with 997 additions and 961 deletions

View File

@@ -24,7 +24,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {}
with patch(
@@ -41,7 +41,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
)
await hass.async_block_till_done()
assert result2["type"] == "create_entry"
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == "1.1.1.1"
assert result2["data"] == {
"host": "1.1.1.1",
@@ -109,7 +109,7 @@ async def test_form_invalid_auth(hass: HomeAssistant) -> None:
},
)
assert result2["type"] == "form"
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": "invalid_auth"}
@@ -132,7 +132,7 @@ async def test_form_cannot_connect(hass: HomeAssistant) -> None:
},
)
assert result2["type"] == "form"
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": "cannot_connect"}
@@ -155,5 +155,5 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None:
},
)
assert result2["type"] == "form"
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": "unknown"}