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

@ -22,7 +22,7 @@ async def test_form(
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {}
result2 = await hass.config_entries.flow.async_configure(
@ -35,7 +35,7 @@ async def test_form(
await hass.async_block_till_done()
mock_pyschlage_auth.authenticate.assert_called_once_with()
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == "test-username"
assert result2["data"] == {
"username": "test-username",
@ -60,7 +60,7 @@ async def test_form_invalid_auth(
"password": "test-password",
},
)
assert result2["type"] == FlowResultType.FORM
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": "invalid_auth"}
@ -79,7 +79,7 @@ async def test_form_unknown(hass: HomeAssistant, mock_pyschlage_auth: Mock) -> N
},
)
assert result2["type"] == FlowResultType.FORM
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": "unknown"}
@ -105,7 +105,7 @@ async def test_reauth(
await hass.async_block_till_done()
mock_pyschlage_auth.authenticate.assert_called_once_with()
assert result2["type"] == FlowResultType.ABORT
assert result2["type"] is FlowResultType.ABORT
assert result2["reason"] == "reauth_successful"
assert mock_added_config_entry.data == {
"username": "asdf@asdf.com",
@ -138,7 +138,7 @@ async def test_reauth_invalid_auth(
await hass.async_block_till_done()
mock_pyschlage_auth.authenticate.assert_called_once_with()
assert result2["type"] == FlowResultType.FORM
assert result2["type"] is FlowResultType.FORM
assert result2["errors"] == {"base": "invalid_auth"}
@ -165,7 +165,7 @@ async def test_reauth_wrong_account(
await hass.async_block_till_done()
mock_pyschlage_auth.authenticate.assert_called_once_with()
assert result2["type"] == FlowResultType.ABORT
assert result2["type"] is FlowResultType.ABORT
assert result2["reason"] == "wrong_account"
assert mock_added_config_entry.data == {
"username": "asdf@asdf.com",