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

@ -42,7 +42,7 @@ async def test_import(hass: HomeAssistant) -> None:
thread.DOMAIN, context={"source": "import"}
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Thread"
assert result["data"] == {}
assert result["options"] == {}
@ -65,7 +65,7 @@ async def test_import_then_zeroconf(hass: HomeAssistant) -> None:
thread.DOMAIN, context={"source": "import"}
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
with patch(
"homeassistant.components.thread.async_setup_entry",
@ -75,7 +75,7 @@ async def test_import_then_zeroconf(hass: HomeAssistant) -> None:
thread.DOMAIN, context={"source": "zeroconf"}, data=TEST_ZEROCONF_RECORD
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
assert len(mock_setup_entry.mock_calls) == 0
@ -90,7 +90,7 @@ async def test_user(hass: HomeAssistant) -> None:
thread.DOMAIN, context={"source": "user"}
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Thread"
assert result["data"] == {}
assert result["options"] == {}
@ -108,7 +108,7 @@ async def test_zeroconf(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
thread.DOMAIN, context={"source": "zeroconf"}, data=TEST_ZEROCONF_RECORD
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["errors"] is None
assert result["step_id"] == "confirm"
@ -117,7 +117,7 @@ async def test_zeroconf(hass: HomeAssistant) -> None:
return_value=True,
) as mock_setup_entry:
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Thread"
assert result["data"] == {}
assert result["options"] == {}
@ -144,7 +144,7 @@ async def test_zeroconf_setup_onboarding(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
thread.DOMAIN, context={"source": "zeroconf"}, data=TEST_ZEROCONF_RECORD
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Thread"
assert result["data"] == {}
assert result["options"] == {}
@ -161,7 +161,7 @@ async def test_zeroconf_then_import(hass: HomeAssistant) -> None:
return_value=True,
) as mock_setup_entry:
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
with patch(
"homeassistant.components.thread.async_setup_entry",
@ -171,6 +171,6 @@ async def test_zeroconf_then_import(hass: HomeAssistant) -> None:
thread.DOMAIN, context={"source": "import"}
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
assert len(mock_setup_entry.mock_calls) == 0