Skip to content

Commit

Permalink
New currency bsv (#39)
Browse files Browse the repository at this point in the history
* add tests for BSV currency and traiding pairs

* added new currency BSV
  • Loading branch information
peshay committed Mar 13, 2019
1 parent 80ed9b1 commit d582c40
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions btcde.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def create_url(self, uri):
self.url = uri


TRADING_PAIRS = ['btceur', 'bcheur', 'etheur', 'btgeur']
TRADING_PAIRS = ['btceur', 'bcheur', 'etheur', 'btgeur', 'bsveur']
ORDER_TYPES = ['buy', 'sell']
CURRENCIES = ['btc', 'bch', 'eth', 'btg']
CURRENCIES = ['btc', 'bch', 'eth', 'btg', 'bsv']
BANK_SEATS = ['AT', 'BE', 'BG', 'CH', 'CY', 'CZ',
'DE', 'DK', 'EE', 'ES', 'FI', 'FR',
'GB', 'GR', 'HR', 'HU', 'IE', 'IS',
Expand Down
32 changes: 32 additions & 0 deletions tests/test_btcde_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,38 @@ def test_urlEncoding(self, mock_logger, m):
self.assertEqual(history[0].url, base_url + url_args)
self.assertTrue(mock_logger.debug.called)

def test_allowed_pairs(self, mock_logger, m):
'''Test the allowed trading pairs.'''
i = 0
for pair in ['btceur', 'bcheur', 'etheur', 'btgeur', 'bsveur']:
params = {'trading_pair': pair}
base_url = 'https://api.bitcoin.de/v2/rates'
url_args = '?trading_pair={}'.format(params.get('trading_pair'))
response = self.sampleData('showRates')
m.get(requests_mock.ANY, json=response, status_code=200)
self.conn.showRates(params.get('trading_pair'))
history = m.request_history
self.assertEqual(history[i].method, "GET")
self.assertEqual(history[i].url, base_url + url_args)
self.assertTrue(mock_logger.debug.called)
i += 1

def test_allowed_currency(self, mock_logger, m):
'''Test the allowed currencies.'''
i = 0
for curr in ['btc', 'bch', 'eth', 'btg', 'bsv']:
params = {'currency': curr}
base_url = 'https://api.bitcoin.de/v2/account/ledger'
url_args = '?currency={}'.format(params.get('currency'))
response = self.sampleData('showAccountLedger')
m.get(requests_mock.ANY, json=response, status_code=200)
self.conn.showAccountLedger(params.get('currency'))
history = m.request_history
self.assertEqual(history[i].method, "GET")
self.assertEqual(history[i].url, base_url + url_args)
self.assertTrue(mock_logger.debug.called)
i += 1

def test_decimal_parsing(self, mock_logger, m):
'''Test if the decimal parsing calculates correctly.'''
params = {'type': 'buy',
Expand Down

0 comments on commit d582c40

Please sign in to comment.