@@ 479-491 (lines=13) @@ | ||
476 | self.assertEqual(history[0].url, base_url) |
|
477 | self.assertTrue(mock_logger.debug.called) |
|
478 | ||
479 | def test_urlEncoding(self, mock_logger, m): |
|
480 | '''Test URL encoding on parameters.''' |
|
481 | currency = 'btc' |
|
482 | params = {'datetime_start': '2018-01-01T01:00:00+01:00'} |
|
483 | base_url = f'https://api.bitcoin.de/v4/{currency}/account/ledger' |
|
484 | url_args = '?' + urlencode(params) |
|
485 | response = self.sampleData('showAccountLedger') |
|
486 | m.get(requests_mock.ANY, json=response, status_code=200) |
|
487 | r = self.conn.showAccountLedger(currency, datetime_start="2018-01-01T01:00:00+01:00") |
|
488 | history = m.request_history |
|
489 | self.assertEqual(history[0].method, "GET") |
|
490 | self.assertEqual(history[0].url, base_url + url_args) |
|
491 | self.assertTrue(mock_logger.debug.called) |
|
492 | ||
493 | def test_allowed_pairs(self, mock_logger, m): |
|
494 | '''Test the allowed trading pairs.''' |
|
@@ 454-466 (lines=13) @@ | ||
451 | self.assertEqual(history[0].url, base_url) |
|
452 | self.assertTrue(mock_logger.debug.called) |
|
453 | ||
454 | def test_showAccountLedger(self, mock_logger, m): |
|
455 | '''Test function showAccountLedger.''' |
|
456 | currency = 'btc' |
|
457 | params = {'type': 'all'} |
|
458 | url_args = '?' + urlencode(params) |
|
459 | base_url = f'https://api.bitcoin.de/v4/{currency}/account/ledger' |
|
460 | response = self.sampleData('showAccountLedger') |
|
461 | m.get(requests_mock.ANY, json=response, status_code=200) |
|
462 | self.conn.showAccountLedger(currency, type=params['type']) |
|
463 | history = m.request_history |
|
464 | self.assertEqual(history[0].method, "GET") |
|
465 | self.assertEqual(history[0].url, base_url + url_args) |
|
466 | self.assertTrue(mock_logger.debug.called) |
|
467 | ||
468 | def test_showPermissions(self, mock_logger, m): |
|
469 | '''Test function showPermissions.''' |