Use is in enum comparison in config flow tests U-Z (#114677)

* Use right enum expression U-Z

* Fix
This commit is contained in:
Joost Lekkerkerker 2024-04-02 23:09:56 +02:00 committed by GitHub
parent 83b56ab005
commit 2ef0521d3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 861 additions and 850 deletions

View file

@ -5,9 +5,10 @@ from unittest.mock import patch
from yolink.const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant import config_entries, setup
from homeassistant.components import application_credentials
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
from homeassistant.helpers import config_entry_oauth2_flow
from tests.common import MockConfigEntry
@ -24,7 +25,7 @@ async def test_abort_if_no_configuration(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "missing_credentials"
@ -34,7 +35,7 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
@ -65,7 +66,7 @@ async def test_full_flow(
"redirect_uri": "https://example.com/auth/external/callback",
},
)
assert result["type"] == data_entry_flow.FlowResultType.EXTERNAL_STEP
assert result["type"] is FlowResultType.EXTERNAL_STEP
assert result["url"] == (
f"{OAUTH2_AUTHORIZE}?response_type=code&client_id={CLIENT_ID}"
"&redirect_uri=https://example.com/auth/external/callback"
@ -136,7 +137,7 @@ async def test_abort_if_authorization_timeout(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "authorize_url_timeout"
@ -217,6 +218,6 @@ async def test_reauthentication(
assert token_data["refresh_token"] == "mock-refresh-token"
assert token_data["type"] == "Bearer"
assert token_data["expires_in"] == 60
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "reauth_successful"
assert len(mock_setup.mock_calls) == 1