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

@ -56,7 +56,7 @@ async def test_user_flow(
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
with patch(
@ -66,7 +66,7 @@ async def test_user_flow(
result["flow_id"],
user_input=user_input,
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == expected_result
zone = hass.states.get(user_input[CONF_ZONE])
@ -101,7 +101,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
assert mock_setup_entry.called
result = await hass.config_entries.options.async_init(mock_config.entry_id)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"],
@ -111,7 +111,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
CONF_TOLERANCE: 1,
},
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert mock_config.data == {
CONF_ZONE: "zone.home",
CONF_TRACKED_ENTITIES: ["device_tracker.test2"],
@ -138,7 +138,7 @@ async def test_import_flow(hass: HomeAssistant) -> None:
},
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_NAME: "home",
CONF_ZONE: "zone.home",
@ -182,7 +182,7 @@ async def test_abort_duplicated_entry(hass: HomeAssistant) -> None:
result["flow_id"],
user_input=DATA,
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
await hass.async_block_till_done()
@ -229,7 +229,7 @@ async def test_avoid_duplicated_title(hass: HomeAssistant) -> None:
CONF_TOLERANCE: 10,
},
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "home 2"
await hass.async_block_till_done()
@ -246,7 +246,7 @@ async def test_avoid_duplicated_title(hass: HomeAssistant) -> None:
CONF_TOLERANCE: 10,
},
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "home 4"
await hass.async_block_till_done()