Use is in FlowResultType enum comparison in integration scaffold tests (#135133)

This commit is contained in:
Joris Pelgröm 2025-01-08 22:10:29 +01:00 committed by GitHub
parent acbd501ede
commit 488c5a6b9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -15,7 +15,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> 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 result["errors"] == {}
with patch(
@ -32,7 +32,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Name of the device"
assert result["data"] == {
CONF_HOST: "1.1.1.1",
@ -63,7 +63,7 @@ async def test_form_invalid_auth(
},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {"base": "invalid_auth"}
# Make sure the config flow tests finish with either an
@ -83,7 +83,7 @@ async def test_form_invalid_auth(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Name of the device"
assert result["data"] == {
CONF_HOST: "1.1.1.1",
@ -114,7 +114,7 @@ async def test_form_cannot_connect(
},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {"base": "cannot_connect"}
# Make sure the config flow tests finish with either an
@ -135,7 +135,7 @@ async def test_form_cannot_connect(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Name of the device"
assert result["data"] == {
CONF_HOST: "1.1.1.1",

View File

@ -24,7 +24,7 @@ async def test_config_flow(
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 result["errors"] is None
result = await hass.config_entries.flow.async_configure(
@ -33,7 +33,7 @@ async def test_config_flow(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "My NEW_DOMAIN"
assert result["data"] == {}
assert result["options"] == {
@ -83,7 +83,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
await hass.async_block_till_done()
result = await hass.config_entries.options.async_init(config_entry.entry_id)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "init"
schema = result["data_schema"].schema
assert get_suggested(schema, "entity_id") == input_sensor_1_entity_id
@ -94,7 +94,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
"entity_id": input_sensor_2_entity_id,
},
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
"entity_id": input_sensor_2_entity_id,
"name": "My NEW_DOMAIN",