Use common strings in logi_circle config flow (#41427)

* already_setup->already_configured

* auth_error->invalid_auth

* rm default

* auth_timeout->oauth2_authorize_url_timeout

* enable auto format black

* add oauth2_missing_configuration

* Use standard helper keys

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
schericandMartin Hjelmare authored and GitHub committed 2020-10-11 10:11:45 -05:00
1 parent ae20b3a678
commit 9d6589240f
3 files changed
+20 -18

No files matched your search

@@ -116,7 +116,7 @@ async def test_abort_if_no_implementation_registered(hass):
result = await flow.async_step_user()
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "no_flows"
assert result["reason"] == "missing_configuration"
async def test_abort_if_already_setup(hass):
@@ -126,17 +126,17 @@ async def test_abort_if_already_setup(hass):
with patch.object(hass.config_entries, "async_entries", return_value=[{}]):
result = await flow.async_step_user()
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "already_setup"
assert result["reason"] == "already_configured"
with patch.object(hass.config_entries, "async_entries", return_value=[{}]):
result = await flow.async_step_import()
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "already_setup"
assert result["reason"] == "already_configured"
with patch.object(hass.config_entries, "async_entries", return_value=[{}]):
result = await flow.async_step_code()
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "already_setup"
assert result["reason"] == "already_configured"
with patch.object(hass.config_entries, "async_entries", return_value=[{}]):
result = await flow.async_step_auth()
@@ -146,7 +146,10 @@ async def test_abort_if_already_setup(hass):
@pytest.mark.parametrize(
"side_effect,error",
[(asyncio.TimeoutError, "auth_timeout"), (AuthorizationFailed, "auth_error")],
[
(asyncio.TimeoutError, "authorize_url_timeout"),
(AuthorizationFailed, "invalid_auth"),
],
)
async def test_abort_if_authorize_fails(
hass, mock_logi_circle, side_effect, error