* test that confirms the bug. Same test should pass after fix * make use of correct api url
This commit is contained in:
parent
56e31d05e9
commit
7f8a259beb
@ -44,4 +44,5 @@ class TestCurrencyExchange(unittest.TestCase):
|
|||||||
|
|
||||||
# Exchange rate as on 15th Dec, 2015, should be fetched from fixer.io
|
# Exchange rate as on 15th Dec, 2015, should be fetched from fixer.io
|
||||||
exchange_rate = get_exchange_rate("USD", "INR", "2015-12-15")
|
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)
|
@ -83,7 +83,8 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None):
|
|||||||
|
|
||||||
if not value:
|
if not value:
|
||||||
import requests
|
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,
|
"base": from_currency,
|
||||||
"symbols": to_currency
|
"symbols": to_currency
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user