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

@ -29,7 +29,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
)
assert result["step_id"] == "user"
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
async def test_cannot_connect(
@ -45,7 +45,7 @@ async def test_cannot_connect(
data=user_input,
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
assert result["errors"] == {"base": "cannot_connect"}
@ -65,7 +65,7 @@ async def test_invalid_auth(
data=user_input,
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
assert result["errors"] == {"base": "invalid_auth"}
@ -83,7 +83,7 @@ async def test_unknown_error(
data=user_input,
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "unknown"
@ -106,14 +106,14 @@ async def test_full_reauth_flow_implementation(
data=entry.data,
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "reauth_confirm"
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input={}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
user_input = MOCK_REAUTH_INPUT.copy()
@ -122,7 +122,7 @@ async def test_full_reauth_flow_implementation(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "reauth_successful"
assert entry.data[CONF_API_KEY] == "test-api-key-reauth"
@ -139,7 +139,7 @@ async def test_full_user_flow_implementation(
context={CONF_SOURCE: SOURCE_USER},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
user_input = MOCK_USER_INPUT.copy()
@ -149,7 +149,7 @@ async def test_full_user_flow_implementation(
user_input=user_input,
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "192.168.1.189"
assert result["data"]
@ -166,7 +166,7 @@ async def test_full_user_flow_advanced_options(
DOMAIN, context={CONF_SOURCE: SOURCE_USER, "show_advanced_options": True}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
user_input = {
@ -179,7 +179,7 @@ async def test_full_user_flow_advanced_options(
user_input=user_input,
)
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "192.168.1.189"
assert result["data"]
@ -201,7 +201,7 @@ async def test_options_flow(
result = await hass.config_entries.options.async_init(entry.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(
@ -210,6 +210,6 @@ async def test_options_flow(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"][CONF_UPCOMING_DAYS] == 2
assert result["data"][CONF_WANTED_MAX_ITEMS] == 100