Use is in enum comparison in config flow tests K-O (#114672)

This commit is contained in:
Joost Lekkerkerker 2024-04-02 23:21:42 +02:00 committed by GitHub
parent 3875533f95
commit 5d500cb74b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
107 changed files with 1177 additions and 1147 deletions

View file

@ -4,7 +4,6 @@ from unittest.mock import MagicMock, patch
from pyowm.commons.exceptions import APIRequestError, UnauthorizedError
from homeassistant import data_entry_flow
from homeassistant.components.openweathermap.const import (
DEFAULT_FORECAST_MODE,
DEFAULT_LANGUAGE,
@ -20,6 +19,7 @@ from homeassistant.const import (
CONF_NAME,
)
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
@ -47,7 +47,7 @@ async def test_form(hass: HomeAssistant) -> None:
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
assert result["errors"] == {}
@ -65,7 +65,7 @@ async def test_form(hass: HomeAssistant) -> None:
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.NOT_LOADED
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == CONFIG[CONF_NAME]
assert result["data"][CONF_LATITUDE] == CONFIG[CONF_LATITUDE]
assert result["data"][CONF_LONGITUDE] == CONFIG[CONF_LONGITUDE]
@ -92,14 +92,14 @@ async def test_form_options(hass: HomeAssistant) -> None:
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"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"], user_input={CONF_MODE: "daily"}
)
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert config_entry.options == {
CONF_MODE: "daily",
CONF_LANGUAGE: DEFAULT_LANGUAGE,
@ -111,14 +111,14 @@ async def test_form_options(hass: HomeAssistant) -> None:
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"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"], user_input={CONF_MODE: "onecall_daily"}
)
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert config_entry.options == {
CONF_MODE: "onecall_daily",
CONF_LANGUAGE: DEFAULT_LANGUAGE,