Use is in enum comparison in config flow tests P-T (#114675)
This commit is contained in:
parent
5d500cb74b
commit
ee66f6ec8c
164 changed files with 1919 additions and 1890 deletions
|
@ -76,7 +76,7 @@ async def test_form_2fa(
|
|||
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"] == {}
|
||||
|
||||
mock_ring_auth.fetch_token.side_effect = ring_doorbell.Requires2FAError
|
||||
|
@ -92,7 +92,7 @@ async def test_form_2fa(
|
|||
"foo@bar.com", "fake-password", None
|
||||
)
|
||||
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["type"] is FlowResultType.FORM
|
||||
assert result2["step_id"] == "2fa"
|
||||
mock_ring_auth.fetch_token.reset_mock(side_effect=True)
|
||||
mock_ring_auth.fetch_token.return_value = "new-foobar"
|
||||
|
@ -104,7 +104,7 @@ async def test_form_2fa(
|
|||
mock_ring_auth.fetch_token.assert_called_once_with(
|
||||
"foo@bar.com", "fake-password", "123456"
|
||||
)
|
||||
assert result3["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result3["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result3["title"] == "foo@bar.com"
|
||||
assert result3["data"] == {
|
||||
"username": "foo@bar.com",
|
||||
|
@ -139,7 +139,7 @@ async def test_reauth(
|
|||
mock_ring_auth.fetch_token.assert_called_once_with(
|
||||
"foo@bar.com", "other_fake_password", None
|
||||
)
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["type"] is FlowResultType.FORM
|
||||
assert result2["step_id"] == "2fa"
|
||||
mock_ring_auth.fetch_token.reset_mock(side_effect=True)
|
||||
mock_ring_auth.fetch_token.return_value = "new-foobar"
|
||||
|
@ -151,7 +151,7 @@ async def test_reauth(
|
|||
mock_ring_auth.fetch_token.assert_called_once_with(
|
||||
"foo@bar.com", "other_fake_password", "123456"
|
||||
)
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert result3["type"] is FlowResultType.ABORT
|
||||
assert result3["reason"] == "reauth_successful"
|
||||
assert mock_added_config_entry.data == {
|
||||
"username": "foo@bar.com",
|
||||
|
@ -197,7 +197,7 @@ async def test_reauth_error(
|
|||
mock_ring_auth.fetch_token.assert_called_once_with(
|
||||
"foo@bar.com", "error_fake_password", None
|
||||
)
|
||||
assert result2["type"] == FlowResultType.FORM
|
||||
assert result2["type"] is FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": errors_msg}
|
||||
|
||||
# Now test reauth can go on to succeed
|
||||
|
@ -213,7 +213,7 @@ async def test_reauth_error(
|
|||
mock_ring_auth.fetch_token.assert_called_once_with(
|
||||
"foo@bar.com", "other_fake_password", None
|
||||
)
|
||||
assert result3["type"] == FlowResultType.ABORT
|
||||
assert result3["type"] is FlowResultType.ABORT
|
||||
assert result3["reason"] == "reauth_successful"
|
||||
assert mock_added_config_entry.data == {
|
||||
"username": "foo@bar.com",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue