Update tests for new wallet RPC structure

This commit is contained in:
Matthias 2022-02-22 19:30:07 +01:00
parent 13e74c5693
commit d07a24a54f
4 changed files with 20 additions and 1 deletions

View File

@ -568,7 +568,6 @@ class RPC:
def _rpc_balance(self, stake_currency: str, fiat_display_currency: str) -> Dict:
""" Returns current account balance per crypto """
currencies = []
positions = []
total = 0.0
try:
tickers = self._freqtrade.exchange.get_tickers(cached=True)

View File

@ -636,6 +636,10 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
'used': 2.0,
'est_stake': 12.0,
'stake': 'BTC',
'is_position': False,
'leverage': 1.0,
'position': 0.0,
'side': 'long',
},
{'free': 1.0,
'balance': 5.0,
@ -643,6 +647,10 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
'est_stake': 0.30794,
'used': 4.0,
'stake': 'BTC',
'is_position': False,
'leverage': 1.0,
'position': 0.0,
'side': 'long',
},
{'free': 5.0,
@ -651,6 +659,10 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
'est_stake': 0.0011563153318162476,
'used': 5.0,
'stake': 'BTC',
'is_position': False,
'leverage': 1.0,
'position': 0.0,
'side': 'long',
}
]
assert result['total'] == 12.309096315331816

View File

@ -453,6 +453,10 @@ def test_api_balance(botclient, mocker, rpc_balance, tickers):
'used': 0.0,
'est_stake': 12.0,
'stake': 'BTC',
'is_position': False,
'leverage': 1.0,
'position': 0.0,
'side': 'long',
}
assert 'starting_capital' in response
assert 'starting_capital_fiat' in response

View File

@ -905,6 +905,10 @@ def test_balance_handle_too_large_response(default_conf, update, mocker) -> None
'balance': i,
'est_stake': 1,
'stake': 'BTC',
'is_position': False,
'leverage': 1.0,
'position': 0.0,
'side': 'long',
})
mocker.patch('freqtrade.rpc.rpc.RPC._rpc_balance', return_value={
'currencies': balances,