-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
With definition of supported rates like:
def __init__(self):
"""Populate supported currencies list."""
rates = self.get_rates()['rates']
self.supported_currencies = [cur for cur in rates]'EUR' is omitted because is used as base here:
| rates = self.get_rates()['rates'] |
then:
assert exchange_api.is_currency_supported('EUR')will raise False.
My suggestion to solve it:
- Remove supported_currencies variable from
Api - Update is_currency_supported about base parameter:
def is_currency_supported(self, currency, base='EUR'):
"""Populate supported currencies list."""
rates = self.get_rates(base)['rates']
supported_currencies = [cur for cur in rates]
return currency in supported_currencies- Add test cases:
-
assert exchange_api.is_currency_supported('EUR', base='USD) -
assert not exchange_api.is_currency_supported('EUR')-> https://exchangeratesapi.io/latest?base=EUR&symbols=EUR ends with404error
Metadata
Metadata
Assignees
Labels
No labels