Use common strings for somfy config flow (#40594)
This commit is contained in:
parent
c011f3fa95
commit
f6435affe9
3 changed files with 6 additions and 4 deletions
|
@ -24,6 +24,6 @@ class SomfyFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler):
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(self, user_input=None):
|
||||||
"""Handle a flow start."""
|
"""Handle a flow start."""
|
||||||
if self.hass.config_entries.async_entries(DOMAIN):
|
if self.hass.config_entries.async_entries(DOMAIN):
|
||||||
return self.async_abort(reason="already_setup")
|
return self.async_abort(reason="single_instance_allowed")
|
||||||
|
|
||||||
return await super().async_step_user(user_input)
|
return await super().async_step_user(user_input)
|
||||||
|
|
|
@ -4,11 +4,13 @@
|
||||||
"pick_implementation": { "title": "Pick Authentication Method" }
|
"pick_implementation": { "title": "Pick Authentication Method" }
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_setup": "You can only configure one Somfy account.",
|
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
|
||||||
"authorize_url_timeout": "Timeout generating authorize url.",
|
"authorize_url_timeout": "Timeout generating authorize url.",
|
||||||
"missing_configuration": "The Somfy component is not configured. Please follow the documentation.",
|
"missing_configuration": "The Somfy component is not configured. Please follow the documentation.",
|
||||||
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]"
|
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]"
|
||||||
},
|
},
|
||||||
"create_entry": { "default": "Successfully authenticated with Somfy." }
|
"create_entry": {
|
||||||
|
"default": "[%key:common::config_flow::create_entry::authenticated%]"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ async def test_abort_if_existing_entry(hass):
|
||||||
|
|
||||||
result = await flow.async_step_user()
|
result = await flow.async_step_user()
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||||
assert result["reason"] == "already_setup"
|
assert result["reason"] == "single_instance_allowed"
|
||||||
|
|
||||||
|
|
||||||
async def test_full_flow(hass, aiohttp_client, aioclient_mock, current_request):
|
async def test_full_flow(hass, aiohttp_client, aioclient_mock, current_request):
|
||||||
|
|
Loading…
Add table
Reference in a new issue