spelling: components/coinbase (#64239)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>pull/64815/head
parent
22656f6082
commit
867392778e
homeassistant/components/coinbase
tests/components/coinbase
|
@ -85,12 +85,12 @@ async def validate_options(
|
|||
if CONF_CURRENCIES in options:
|
||||
for currency in options[CONF_CURRENCIES]:
|
||||
if currency not in accounts_currencies:
|
||||
raise CurrencyUnavaliable
|
||||
raise CurrencyUnavailable
|
||||
|
||||
if CONF_EXCHANGE_RATES in options:
|
||||
for rate in options[CONF_EXCHANGE_RATES]:
|
||||
if rate not in available_rates[API_RATES]:
|
||||
raise ExchangeRateUnavaliable
|
||||
raise ExchangeRateUnavailable
|
||||
|
||||
return True
|
||||
|
||||
|
@ -191,10 +191,10 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||
|
||||
try:
|
||||
await validate_options(self.hass, self.config_entry, user_input)
|
||||
except CurrencyUnavaliable:
|
||||
errors["base"] = "currency_unavaliable"
|
||||
except ExchangeRateUnavaliable:
|
||||
errors["base"] = "exchange_rate_unavaliable"
|
||||
except CurrencyUnavailable:
|
||||
errors["base"] = "currency_unavailable"
|
||||
except ExchangeRateUnavailable:
|
||||
errors["base"] = "exchange_rate_unavailable"
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unexpected exception")
|
||||
errors["base"] = "unknown"
|
||||
|
@ -243,9 +243,9 @@ class AlreadyConfigured(exceptions.HomeAssistantError):
|
|||
"""Error to indicate Coinbase API Key is already configured."""
|
||||
|
||||
|
||||
class CurrencyUnavaliable(exceptions.HomeAssistantError):
|
||||
class CurrencyUnavailable(exceptions.HomeAssistantError):
|
||||
"""Error to indicate the requested currency resource is not provided by the API."""
|
||||
|
||||
|
||||
class ExchangeRateUnavaliable(exceptions.HomeAssistantError):
|
||||
class ExchangeRateUnavailable(exceptions.HomeAssistantError):
|
||||
"""Error to indicate the requested exchange rate resource is not provided by the API."""
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
},
|
||||
"error": {
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]",
|
||||
"currency_unavaliable": "One or more of the requested currency balances is not provided by your Coinbase API.",
|
||||
"exchange_rate_unavaliable": "One or more of the requested exchange rates is not provided by Coinbase."
|
||||
"currency_unavailable": "One or more of the requested currency balances is not provided by your Coinbase API.",
|
||||
"exchange_rate_unavailable": "One or more of the requested exchange rates is not provided by Coinbase."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,8 +25,8 @@
|
|||
},
|
||||
"options": {
|
||||
"error": {
|
||||
"currency_unavaliable": "One or more of the requested currency balances is not provided by your Coinbase API.",
|
||||
"exchange_rate_unavaliable": "One or more of the requested exchange rates is not provided by Coinbase.",
|
||||
"currency_unavailable": "One or more of the requested currency balances is not provided by your Coinbase API.",
|
||||
"exchange_rate_unavailable": "One or more of the requested exchange rates is not provided by Coinbase.",
|
||||
"unknown": "Unexpected error"
|
||||
},
|
||||
"step": {
|
||||
|
|
|
@ -44,7 +44,7 @@ class MockGetAccounts:
|
|||
|
||||
|
||||
def mocked_get_accounts(_, **kwargs):
|
||||
"""Return simplied accounts using mock."""
|
||||
"""Return simplified accounts using mock."""
|
||||
return MockGetAccounts(**kwargs)
|
||||
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ async def test_form_bad_account_currency(hass):
|
|||
)
|
||||
|
||||
assert result2["type"] == "form"
|
||||
assert result2["errors"] == {"base": "currency_unavaliable"}
|
||||
assert result2["errors"] == {"base": "currency_unavailable"}
|
||||
|
||||
|
||||
async def test_form_bad_exchange_rate(hass):
|
||||
|
@ -266,7 +266,7 @@ async def test_form_bad_exchange_rate(hass):
|
|||
},
|
||||
)
|
||||
assert result2["type"] == "form"
|
||||
assert result2["errors"] == {"base": "exchange_rate_unavaliable"}
|
||||
assert result2["errors"] == {"base": "exchange_rate_unavailable"}
|
||||
|
||||
|
||||
async def test_option_catch_all_exception(hass):
|
||||
|
|
Loading…
Reference in New Issue