Merge branch 'master' into staging

This commit is contained in:
mbauskar
2017-08-31 15:31:48 +05:30
10 changed files with 100 additions and 29 deletions

View File

@@ -44,4 +44,5 @@ class TestCurrencyExchange(unittest.TestCase):
# Exchange rate as on 15th Dec, 2015, should be fetched from fixer.io
exchange_rate = get_exchange_rate("USD", "INR", "2015-12-15")
self.assertFalse(exchange_rate==60)
self.assertFalse(exchange_rate == 60)
self.assertEqual(exchange_rate, 66.894)

View File

@@ -83,7 +83,8 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None):
if not value:
import requests
response = requests.get("http://api.fixer.io/latest", params={
api_url = "http://api.fixer.io/{0}".format(transaction_date)
response = requests.get(api_url, params={
"base": from_currency,
"symbols": to_currency
})