Use is in enum comparison in config flow tests P-T (#114675)

This commit is contained in:
Joost Lekkerkerker 2024-04-02 23:21:50 +02:00 committed by GitHub
parent 5d500cb74b
commit ee66f6ec8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
164 changed files with 1919 additions and 1890 deletions

View file

@ -5,10 +5,11 @@ from unittest.mock import patch
import pytest
from simplepush import UnknownError
from homeassistant import config_entries, data_entry_flow
from homeassistant import config_entries
from homeassistant.components.simplepush.const import CONF_DEVICE_KEY, CONF_SALT, DOMAIN
from homeassistant.const import CONF_NAME, CONF_PASSWORD
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
@ -44,7 +45,7 @@ async def test_flow_successful(hass: HomeAssistant) -> None:
result["flow_id"],
user_input=MOCK_CONFIG,
)
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "simplepush"
assert result["data"] == MOCK_CONFIG
@ -60,7 +61,7 @@ async def test_flow_with_password(hass: HomeAssistant) -> None:
result["flow_id"],
user_input=mock_config_pass,
)
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "simplepush"
assert result["data"] == mock_config_pass
@ -83,7 +84,7 @@ async def test_flow_user_device_key_already_configured(hass: HomeAssistant) -> N
result["flow_id"],
user_input=MOCK_CONFIG,
)
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
@ -108,7 +109,7 @@ async def test_flow_user_name_already_configured(hass: HomeAssistant) -> None:
result["flow_id"],
user_input=MOCK_CONFIG,
)
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
@ -126,5 +127,5 @@ async def test_error_on_connection_failure(hass: HomeAssistant) -> None:
result["flow_id"],
user_input=MOCK_CONFIG,
)
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {"base": "cannot_connect"}