1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

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
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") == "12345"
assert result2.get("data") == {
CONF_SYSTEM_ID: 12345,
@@ -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_pvoutput.system.side_effect = PVOutputAuthenticationError
@@ -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") == "12345"
assert result3.get("data") == {
CONF_SYSTEM_ID: 12345,
@@ -111,7 +111,7 @@ async def test_connection_error(hass: HomeAssistant, mock_pvoutput: MagicMock) -
},
)
assert result.get("type") == FlowResultType.FORM
assert result.get("type") is FlowResultType.FORM
assert result.get("errors") == {"base": "cannot_connect"}
assert len(mock_pvoutput.system.mock_calls) == 1
@@ -137,7 +137,7 @@ async def test_already_configured(
},
)
assert result2.get("type") == FlowResultType.ABORT
assert result2.get("type") is FlowResultType.ABORT
assert result2.get("reason") == "already_configured"
@@ -159,7 +159,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(
@@ -168,7 +168,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_SYSTEM_ID: 12345,
@@ -201,7 +201,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_pvoutput.system.side_effect = PVOutputAuthenticationError
@@ -211,7 +211,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"}
@@ -225,7 +225,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_SYSTEM_ID: 12345,
@@ -253,7 +253,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_pvoutput.system.side_effect = PVOutputConnectionError
@@ -263,6 +263,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"}