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

@ -84,7 +84,7 @@ async def test_form(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert not result["errors"]
with patch(
@ -100,7 +100,7 @@ async def test_form(hass: HomeAssistant) -> None:
)
await hass.async_block_till_done()
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == TEST_TITLE
assert result2["data"] == {
CONF_HOST: TEST_HOST,
@ -127,7 +127,7 @@ async def test_form_cannot_connect(
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert not result["errors"]
with patch(
@ -142,7 +142,7 @@ async def test_form_cannot_connect(
},
)
assert result2["type"] == FlowResultType.FORM
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": base_value}
@ -151,7 +151,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert not result["errors"]
with patch(
@ -166,7 +166,7 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None:
},
)
assert result2["type"] == FlowResultType.FORM
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": "unknown"}
@ -177,7 +177,7 @@ async def test_zeroconf_discovery(hass: HomeAssistant) -> None:
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=ZEROCONF_DATA
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert not result["errors"]
with patch(
@ -193,7 +193,7 @@ async def test_zeroconf_discovery(hass: HomeAssistant) -> None:
)
await hass.async_block_till_done()
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == TEST_TITLE
assert result2["data"] == {
CONF_HOST: TEST_NAME + ".local",
@ -207,5 +207,5 @@ async def test_zeroconf_discovery(hass: HomeAssistant) -> None:
DOMAIN, context={"source": config_entries.SOURCE_ZEROCONF}, data=ZEROCONF_DATA
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"