From 606e41d5743594bc69a30e548de1046e3480a1ea Mon Sep 17 00:00:00 2001 From: misagh Date: Sat, 17 Nov 2018 22:58:27 +0100 Subject: [PATCH] wallet tests added --- freqtrade/tests/finance/test_wallets.py | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 freqtrade/tests/finance/test_wallets.py diff --git a/freqtrade/tests/finance/test_wallets.py b/freqtrade/tests/finance/test_wallets.py new file mode 100644 index 000000000..e226d117f --- /dev/null +++ b/freqtrade/tests/finance/test_wallets.py @@ -0,0 +1,32 @@ +# pragma pylint: disable=missing-docstring +from freqtrade.tests.conftest import get_patched_freqtradebot +from unittest.mock import MagicMock + + +def test_sync_wallet_at_boot(mocker, default_conf): + mocker.patch.multiple( + 'freqtrade.exchange.Exchange', + get_balances=MagicMock(return_value={ + "BNT": { + "free": 1.0, + "used": 2.0, + "total": 3.0 + }, + "GAS": { + "free": 0.260739, + "used": 0.0, + "total": 0.260739 + }, + }) + ) + + freqtrade = get_patched_freqtradebot(mocker, default_conf) + + assert len(freqtrade.wallets.wallets) == 2 + assert freqtrade.wallets.wallets['BNT'].free == 1.0 + assert freqtrade.wallets.wallets['BNT'].used == 2.0 + assert freqtrade.wallets.wallets['BNT'].total == 3.0 + + assert freqtrade.wallets.wallets['GAS'].free == 0.260739 + assert freqtrade.wallets.wallets['GAS'].used == 0.0 + assert freqtrade.wallets.wallets['GAS'].total == 0.260739