def test_returns_historical_rates_for_base_passed_if_both(self):
base = 'USD'
another_base = 'EUR'
expected_response = {'base': base, 'date': '2016-05-13',
'rates': {'GBP': 0.69403}}
httpretty.register_uri(httpretty.GET,
self.url,
body=json.dumps(expected_response),
content_type='application/json')
client = Fixerio(base=another_base)
response = client.historical_rates(date=self.date, base=base)
self.assertDictEqual(response, expected_response)
request = httpretty.last_request()
self.assertEqual(request.method, 'GET')
params = urlencode({'base': base})
expected_path = '{url}?{params}'.format(url=self.path, params=params)
self.assertEqual(request.path, expected_path)
self.assertEqual(request.querystring, {'base': [base]})
self.assertEqual(request.body, b'')
评论列表
文章目录