|
@@ 349-363 (lines=15) @@
|
| 346 |
|
self.assertEqual(history[0].url, base_url + url_args) |
| 347 |
|
self.assertTrue(mock_logger.debug.called) |
| 348 |
|
|
| 349 |
|
def test_allowed_pairs(self, mock_logger, m): |
| 350 |
|
'''Test the allowed trading pairs.''' |
| 351 |
|
i = 0 |
| 352 |
|
for pair in ['btceur', 'bcheur', 'etheur', 'btgeur', 'bsveur']: |
| 353 |
|
params = {'trading_pair': pair} |
| 354 |
|
base_url = 'https://api.bitcoin.de/v2/rates' |
| 355 |
|
url_args = '?trading_pair={}'.format(params.get('trading_pair')) |
| 356 |
|
response = self.sampleData('showRates') |
| 357 |
|
m.get(requests_mock.ANY, json=response, status_code=200) |
| 358 |
|
self.conn.showRates(params.get('trading_pair')) |
| 359 |
|
history = m.request_history |
| 360 |
|
self.assertEqual(history[i].method, "GET") |
| 361 |
|
self.assertEqual(history[i].url, base_url + url_args) |
| 362 |
|
self.assertTrue(mock_logger.debug.called) |
| 363 |
|
i += 1 |
| 364 |
|
|
| 365 |
|
def test_allowed_currency(self, mock_logger, m): |
| 366 |
|
'''Test the allowed currencies.''' |
|
@@ 310-321 (lines=12) @@
|
| 307 |
|
self.assertEqual(history[0].url, base_url + url_args) |
| 308 |
|
self.assertTrue(mock_logger.debug.called) |
| 309 |
|
|
| 310 |
|
def test_showRates(self, mock_logger, m): |
| 311 |
|
'''Test function showRates.''' |
| 312 |
|
params = {'trading_pair': 'btceur'} |
| 313 |
|
base_url = 'https://api.bitcoin.de/v2/rates' |
| 314 |
|
url_args = '?trading_pair={}'.format(params.get('trading_pair')) |
| 315 |
|
response = self.sampleData('showRates') |
| 316 |
|
m.get(requests_mock.ANY, json=response, status_code=200) |
| 317 |
|
self.conn.showRates(params.get('trading_pair')) |
| 318 |
|
history = m.request_history |
| 319 |
|
self.assertEqual(history[0].method, "GET") |
| 320 |
|
self.assertEqual(history[0].url, base_url + url_args) |
| 321 |
|
self.assertTrue(mock_logger.debug.called) |
| 322 |
|
|
| 323 |
|
def test_showAccountLedger(self, mock_logger, m): |
| 324 |
|
'''Test function showAccountLedger.''' |