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

@ -23,7 +23,7 @@ async def test_full_user_flow(
DOMAIN, context={"source": SOURCE_USER}
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "user"
result2 = await hass.config_entries.flow.async_configure(
@ -34,7 +34,7 @@ async def test_full_user_flow(
},
)
assert result2.get("type") == FlowResultType.CREATE_ENTRY
assert result2.get("type") is FlowResultType.CREATE_ENTRY
assert result2.get("title") == "homeassistant.github"
assert result2.get("data") == {
CONF_TAILNET: "homeassistant.github",
@ -59,7 +59,7 @@ async def test_full_flow_with_authentication_error(
DOMAIN, context={"source": SOURCE_USER}
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "user"
mock_tailscale_config_flow.devices.side_effect = TailscaleAuthenticationError
@ -71,7 +71,7 @@ async def test_full_flow_with_authentication_error(
},
)
assert result2.get("type") == FlowResultType.FORM
assert result2.get("type") is FlowResultType.FORM
assert result2.get("step_id") == "user"
assert result2.get("errors") == {"base": "invalid_auth"}
@ -87,7 +87,7 @@ async def test_full_flow_with_authentication_error(
},
)
assert result3.get("type") == FlowResultType.CREATE_ENTRY
assert result3.get("type") is FlowResultType.CREATE_ENTRY
assert result3.get("title") == "homeassistant.github"
assert result3.get("data") == {
CONF_TAILNET: "homeassistant.github",
@ -113,7 +113,7 @@ async def test_connection_error(
},
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("errors") == {"base": "cannot_connect"}
assert len(mock_tailscale_config_flow.devices.mock_calls) == 1
@ -137,7 +137,7 @@ async def test_reauth_flow(
},
data=mock_config_entry.data,
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "reauth_confirm"
result2 = await hass.config_entries.flow.async_configure(
@ -146,7 +146,7 @@ async def test_reauth_flow(
)
await hass.async_block_till_done()
assert result2.get("type") == FlowResultType.ABORT
assert result2.get("type") is FlowResultType.ABORT
assert result2.get("reason") == "reauth_successful"
assert mock_config_entry.data == {
CONF_TAILNET: "homeassistant.github",
@ -179,7 +179,7 @@ async def test_reauth_with_authentication_error(
},
data=mock_config_entry.data,
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "reauth_confirm"
mock_tailscale_config_flow.devices.side_effect = TailscaleAuthenticationError
@ -189,7 +189,7 @@ async def test_reauth_with_authentication_error(
)
await hass.async_block_till_done()
assert result2.get("type") == FlowResultType.FORM
assert result2.get("type") is FlowResultType.FORM
assert result2.get("step_id") == "reauth_confirm"
assert result2.get("errors") == {"base": "invalid_auth"}
@ -203,7 +203,7 @@ async def test_reauth_with_authentication_error(
)
await hass.async_block_till_done()
assert result3.get("type") == FlowResultType.ABORT
assert result3.get("type") is FlowResultType.ABORT
assert result3.get("reason") == "reauth_successful"
assert mock_config_entry.data == {
CONF_TAILNET: "homeassistant.github",
@ -231,7 +231,7 @@ async def test_reauth_api_error(
},
data=mock_config_entry.data,
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("step_id") == "reauth_confirm"
mock_tailscale_config_flow.devices.side_effect = TailscaleConnectionError
@ -241,6 +241,6 @@ async def test_reauth_api_error(
)
await hass.async_block_till_done()
assert result2.get("type") == FlowResultType.FORM
assert result2.get("type") is FlowResultType.FORM
assert result2.get("step_id") == "reauth_confirm"
assert result2.get("errors") == {"base": "cannot_connect"}