Use is in enum comparison in config flow tests A-E (#114669)
This commit is contained in:
parent
ee66f6ec8c
commit
9b41e3d124
123 changed files with 1413 additions and 1387 deletions
|
@ -4,10 +4,11 @@ from unittest.mock import ANY, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components import cast
|
||||
from homeassistant.components.cast.home_assistant_cast import CAST_USER_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -29,10 +30,10 @@ async def test_creating_entry_sets_up_media_player(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
# Confirmation form
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
@ -194,7 +195,7 @@ async def test_option_flow(hass: HomeAssistant, parameter_data) -> None:
|
|||
|
||||
# Test ignore_cec and uuid options are hidden if advanced options are disabled
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "basic_options"
|
||||
data_schema = result["data_schema"].schema
|
||||
assert set(data_schema) == {"known_hosts"}
|
||||
|
@ -205,7 +206,7 @@ async def test_option_flow(hass: HomeAssistant, parameter_data) -> None:
|
|||
result = await hass.config_entries.options.async_init(
|
||||
config_entry.entry_id, context=context
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "basic_options"
|
||||
data_schema = result["data_schema"].schema
|
||||
for other_param in basic_parameters:
|
||||
|
@ -222,7 +223,7 @@ async def test_option_flow(hass: HomeAssistant, parameter_data) -> None:
|
|||
result["flow_id"],
|
||||
user_input=user_input_dict,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "advanced_options"
|
||||
for other_param in basic_parameters:
|
||||
if other_param == parameter:
|
||||
|
@ -247,7 +248,7 @@ async def test_option_flow(hass: HomeAssistant, parameter_data) -> None:
|
|||
result["flow_id"],
|
||||
user_input=user_input_dict,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] is None
|
||||
for other_param in advanced_parameters:
|
||||
if other_param == parameter:
|
||||
|
@ -261,7 +262,7 @@ async def test_option_flow(hass: HomeAssistant, parameter_data) -> None:
|
|||
result["flow_id"],
|
||||
user_input={"known_hosts": ""},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"] is None
|
||||
expected_data = {**orig_data, "known_hosts": []}
|
||||
if parameter in advanced_parameters:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue