From 701978a4b1e8ee2238ded16d7a5276957cb05403 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 10 Oct 2018 22:01:22 +0200 Subject: [PATCH] Add test for dust hiding --- freqtrade/rpc/telegram.py | 2 +- freqtrade/tests/rpc/test_rpc_telegram.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 996137728..040f053f1 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -314,7 +314,7 @@ class Telegram(RPC): "\t`Pending: {pending: .8f}`\n" \ "\t`Est. BTC: {est_btc: .8f}`\n".format(**currency) else: - output += "*{currency}*: not showing <1$ amount \n".format(**currency) + output += "*{currency}:* not showing <1$ amount \n".format(**currency) output += "\n*Estimated Value*:\n" \ "\t`BTC: {total: .8f}`\n" \ diff --git a/freqtrade/tests/rpc/test_rpc_telegram.py b/freqtrade/tests/rpc/test_rpc_telegram.py index 182c1d2e7..892c851bd 100644 --- a/freqtrade/tests/rpc/test_rpc_telegram.py +++ b/freqtrade/tests/rpc/test_rpc_telegram.py @@ -507,7 +507,12 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None: 'total': 10.0, 'free': 10.0, 'used': 0.0 - } + }, + 'XRP': { + 'total': 1.0, + 'free': 1.0, + 'used': 0.0 + } } def mock_ticker(symbol, refresh): @@ -517,7 +522,12 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None: 'ask': 10000.00, 'last': 10000.00, } - + elif symbol == 'XRP/BTC': + return { + 'bid': 0.00001, + 'ask': 0.00001, + 'last': 0.00001, + } return { 'bid': 0.1, 'ask': 0.1, @@ -548,7 +558,8 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None: assert '*USDT:*' in result assert 'Balance:' in result assert 'Est. BTC:' in result - assert 'BTC: 14.00000000' in result + assert 'BTC: 12.00000000' in result + assert '*XRP:* not showing <1$ amount' in result def test_balance_handle_empty_response(default_conf, update, mocker) -> None: