def test_returns_latest_rates_for_base_passed_in_constructor(self):
base = 'USD'
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=base)
response = client.latest()
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'')
评论列表
文章目录