Use is in enum comparison in config flow tests P-T (#114675)
This commit is contained in:
parent
5d500cb74b
commit
ee66f6ec8c
164 changed files with 1919 additions and 1890 deletions
|
@ -4,10 +4,11 @@ from unittest.mock import patch
|
|||
|
||||
from aiosyncthing.exceptions import UnauthorizedError
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.syncthing.const import DOMAIN
|
||||
from homeassistant.const import CONF_NAME, CONF_TOKEN, CONF_URL, CONF_VERIFY_SSL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -30,7 +31,7 @@ async def test_show_setup_form(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.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
@ -54,7 +55,7 @@ async def test_flow_successful(hass: HomeAssistant) -> None:
|
|||
CONF_VERIFY_SSL: VERIFY_SSL,
|
||||
},
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "http://127.0.0.1:8384"
|
||||
assert result["data"][CONF_NAME] == NAME
|
||||
assert result["data"][CONF_URL] == URL
|
||||
|
@ -76,7 +77,7 @@ async def test_flow_already_configured(hass: HomeAssistant) -> None:
|
|||
data=MOCK_ENTRY,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
|
@ -90,7 +91,7 @@ async def test_flow_invalid_auth(hass: HomeAssistant) -> None:
|
|||
data=MOCK_ENTRY,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"]["token"] == "invalid_auth"
|
||||
|
||||
|
||||
|
@ -104,5 +105,5 @@ async def test_flow_cannot_connect(hass: HomeAssistant) -> None:
|
|||
data=MOCK_ENTRY,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"]["base"] == "cannot_connect"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue