Fix bug causing /balance to fail

This commit is contained in:
Matthias
2018-08-08 21:55:48 +02:00
parent 3c451e0677
commit e1921c8849
3 changed files with 15 additions and 34 deletions

View File

@@ -286,11 +286,12 @@ def test_rpc_balance_handle(default_conf, mocker):
'used': 2.0,
},
'ETH': {
'free': 0.0,
'total': 0.0,
'used': 0.0,
'free': 1.0,
'total': 5.0,
'used': 4.0,
}
}
# ETH will be skipped due to mocked Error below
mocker.patch.multiple(
'freqtrade.fiat_convert.Market',
@@ -302,7 +303,8 @@ def test_rpc_balance_handle(default_conf, mocker):
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
validate_pairs=MagicMock(),
get_balances=MagicMock(return_value=mock_balance)
get_balances=MagicMock(return_value=mock_balance),
get_ticker=MagicMock(side_effect=TemporaryError('Could not load ticker due to xxx'))
)
freqtradebot = FreqtradeBot(default_conf)
@@ -323,31 +325,6 @@ def test_rpc_balance_handle(default_conf, mocker):
}]
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:
patch_coinmarketcap(mocker)