Add test for bugreport #1111

This commit is contained in:
Matthias 2018-08-08 21:54:52 +02:00
parent eca5c6f389
commit 3c451e0677

View File

@ -6,6 +6,7 @@ from unittest.mock import MagicMock, ANY
import pytest
from freqtrade import TemporaryError
from freqtrade.fiat_convert import CryptoToFiatConverter
from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.persistence import Trade
@ -320,6 +321,32 @@ def test_rpc_balance_handle(default_conf, mocker):
'pending': 2.0,
'est_btc': 12.0,
}]
assert result['total'] == 12.0
mock_balance = {
'ETH': {
'free': 10.0,
'total': 12.0,
'used': 2.0,
}
}
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
validate_pairs=MagicMock(),
get_balances=MagicMock(return_value=mock_balance),
get_ticker=MagicMock(side_effect=TemporaryError('Could not load ticker due to xxx'))
)
result = rpc._rpc_balance(default_conf['fiat_display_currency'])
assert prec_satoshi(result['total'], 12)
assert prec_satoshi(result['value'], 180000)
assert 'USD' == result['symbol']
assert result['currencies'] == [{
'currency': 'ETH',
'available': 10.0,
'balance': 12.0,
'pending': 2.0,
'est_btc': 12.0,
}]
def test_rpc_start(mocker, default_conf) -> None: