Add test for dust hiding

This commit is contained in:
Matthias 2018-10-10 22:01:22 +02:00
parent 792d2dbe32
commit 701978a4b1
2 changed files with 15 additions and 4 deletions

View File

@ -314,7 +314,7 @@ class Telegram(RPC):
"\t`Pending: {pending: .8f}`\n" \ "\t`Pending: {pending: .8f}`\n" \
"\t`Est. BTC: {est_btc: .8f}`\n".format(**currency) "\t`Est. BTC: {est_btc: .8f}`\n".format(**currency)
else: else:
output += "*{currency}*: not showing <1$ amount \n".format(**currency) output += "*{currency}:* not showing <1$ amount \n".format(**currency)
output += "\n*Estimated Value*:\n" \ output += "\n*Estimated Value*:\n" \
"\t`BTC: {total: .8f}`\n" \ "\t`BTC: {total: .8f}`\n" \

View File

@ -507,7 +507,12 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
'total': 10.0, 'total': 10.0,
'free': 10.0, 'free': 10.0,
'used': 0.0 'used': 0.0
} },
'XRP': {
'total': 1.0,
'free': 1.0,
'used': 0.0
}
} }
def mock_ticker(symbol, refresh): def mock_ticker(symbol, refresh):
@ -517,7 +522,12 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
'ask': 10000.00, 'ask': 10000.00,
'last': 10000.00, 'last': 10000.00,
} }
elif symbol == 'XRP/BTC':
return {
'bid': 0.00001,
'ask': 0.00001,
'last': 0.00001,
}
return { return {
'bid': 0.1, 'bid': 0.1,
'ask': 0.1, 'ask': 0.1,
@ -548,7 +558,8 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
assert '*USDT:*' in result assert '*USDT:*' in result
assert 'Balance:' in result assert 'Balance:' in result
assert 'Est. BTC:' 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: def test_balance_handle_empty_response(default_conf, update, mocker) -> None: