From b70d02e46d24e74b3d875a7776c02589b9d52730 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 5 Jan 2025 11:29:15 +0100 Subject: [PATCH] test: add test for kraken balance problem part of #11118 --- tests/exchange/test_kraken.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/exchange/test_kraken.py b/tests/exchange/test_kraken.py index c3a3b1b93..a92fe236d 100644 --- a/tests/exchange/test_kraken.py +++ b/tests/exchange/test_kraken.py @@ -58,8 +58,10 @@ def test_kraken_trading_agreement(default_conf, mocker, order_type, time_in_forc def test_get_balances_prod_kraken(default_conf, mocker): balance_item = {"free": 0.0, "total": 10.0, "used": 0.0} + kraken = ccxt.kraken() api_mock = MagicMock() + api_mock.commonCurrencies = kraken.commonCurrencies api_mock.fetch_balance = MagicMock( return_value={ "1ST": {"free": 0.0, "total": 0.0, "used": 0.0}, @@ -68,6 +70,8 @@ def test_get_balances_prod_kraken(default_conf, mocker): "3RD": balance_item.copy(), "4TH": balance_item.copy(), "EUR": balance_item.copy(), + "BTC": {"free": 0.0, "total": 0.0, "used": 0.0}, + "XBT.F": balance_item.copy(), "timestamp": 123123, } ) @@ -124,7 +128,7 @@ def test_get_balances_prod_kraken(default_conf, mocker): default_conf["dry_run"] = False exchange = get_patched_exchange(mocker, default_conf, api_mock, exchange="kraken") balances = exchange.get_balances() - assert len(balances) == 6 + assert len(balances) == 8 assert balances["1ST"]["free"] == 9.0 assert balances["1ST"]["total"] == 10.0 @@ -145,6 +149,10 @@ def test_get_balances_prod_kraken(default_conf, mocker): assert balances["EUR"]["free"] == 8.0 assert balances["EUR"]["total"] == 10.0 assert balances["EUR"]["used"] == 2.0 + + assert balances["BTC"]["free"] == 10.0 + assert balances["BTC"]["total"] == 10.0 + assert balances["BTC"]["used"] == 0.0 ccxt_exceptionhandlers( mocker, default_conf, api_mock, "kraken", "get_balances", "fetch_balance" )