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

@ -61,7 +61,7 @@ async def complete_flow(hass: HomeAssistant) -> FlowResult:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "user"
assert not result.get("errors")
assert "flow_id" in result
@ -165,7 +165,7 @@ async def test_multiple_config_entries(
responses.extend(config_flow_responses)
result = await complete_flow(hass)
assert result.get("type") == FlowResultType.CREATE_ENTRY
assert result.get("type") is FlowResultType.CREATE_ENTRY
assert dict(result.get("result").data) == expected_config_entry
entries = hass.config_entries.async_entries(DOMAIN)
@ -241,7 +241,7 @@ async def test_duplicate_config_entries(
result = await complete_flow(hass)
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
assert result.get("type") == FlowResultType.ABORT
assert result.get("type") is FlowResultType.ABORT
assert result.get("reason") == "already_configured"
assert dict(config_entry.data) == expected_config_entry_data
@ -261,7 +261,7 @@ async def test_controller_cannot_connect(
)
result = await complete_flow(hass)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "user"
assert result.get("errors") == {"base": "cannot_connect"}
@ -279,7 +279,7 @@ async def test_controller_timeout(
side_effect=TimeoutError,
):
result = await complete_flow(hass)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "user"
assert result.get("errors") == {"base": "timeout_connect"}
@ -303,14 +303,14 @@ async def test_options_flow(hass: HomeAssistant, mock_setup: Mock) -> None:
# Initiate the options flow
result = await hass.config_entries.options.async_init(config_entry.entry_id)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "init"
# Change the default duration
result = await hass.config_entries.options.async_configure(
result["flow_id"], user_input={ATTR_DURATION: 5}
)
assert result.get("type") == FlowResultType.CREATE_ENTRY
assert result.get("type") is FlowResultType.CREATE_ENTRY
assert config_entry.options == {
ATTR_DURATION: 5,
}