Use FlowResultType enum in config flow tests N-Z (#114682)

Use FlowResultType enum in config flow tests
This commit is contained in:
Joost Lekkerkerker 2024-04-03 09:53:20 +02:00 committed by GitHub
parent 7a543af8ee
commit f3ba713289
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
83 changed files with 941 additions and 914 deletions

View file

@ -7,6 +7,7 @@ import pyzerproc
from homeassistant import config_entries
from homeassistant.components.zerproc.config_flow import DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
async def test_flow_success(hass: HomeAssistant) -> None:
@ -15,7 +16,7 @@ async def test_flow_success(hass: HomeAssistant) -> 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"] is None
with (
@ -34,7 +35,7 @@ async def test_flow_success(hass: HomeAssistant) -> None:
)
await hass.async_block_till_done()
assert result2["type"] == "create_entry"
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == "Zerproc"
assert result2["data"] == {}
@ -47,7 +48,7 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> 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"] is None
with (
@ -65,7 +66,7 @@ async def test_flow_no_devices_found(hass: HomeAssistant) -> None:
{},
)
assert result2["type"] == "abort"
assert result2["type"] is FlowResultType.ABORT
assert result2["reason"] == "no_devices_found"
await hass.async_block_till_done()
assert len(mock_setup_entry.mock_calls) == 0
@ -77,7 +78,7 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> 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"] is None
with (
@ -95,7 +96,7 @@ async def test_flow_exceptions_caught(hass: HomeAssistant) -> None:
{},
)
assert result2["type"] == "abort"
assert result2["type"] is FlowResultType.ABORT
assert result2["reason"] == "no_devices_found"
await hass.async_block_till_done()
assert len(mock_setup_entry.mock_calls) == 0