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:
@@ -5,11 +5,7 @@ from unittest.mock import AsyncMock, MagicMock
|
||||
from homeassistant.components.cpuspeed.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
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
|
||||
|
||||
@@ -24,7 +20,7 @@ async def test_full_user_flow(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@@ -33,7 +29,7 @@ async def test_full_user_flow(
|
||||
user_input={},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_CREATE_ENTRY
|
||||
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "CPU Speed"
|
||||
assert result2.get("data") == {}
|
||||
|
||||
@@ -54,7 +50,7 @@ async def test_already_configured(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_ABORT
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
@@ -71,7 +67,7 @@ async def test_not_compatible(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") == RESULT_TYPE_FORM
|
||||
assert result.get("type") == FlowResultType.FORM
|
||||
assert result.get("step_id") == SOURCE_USER
|
||||
assert "flow_id" in result
|
||||
|
||||
@@ -81,7 +77,7 @@ async def test_not_compatible(
|
||||
user_input={},
|
||||
)
|
||||
|
||||
assert result2.get("type") == RESULT_TYPE_ABORT
|
||||
assert result2.get("type") == FlowResultType.ABORT
|
||||
assert result2.get("reason") == "not_compatible"
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
Reference in New Issue
Block a user