Test iterative sending of /status

This commit is contained in:
Matthias 2022-08-06 09:15:25 +02:00
parent b12dd15f4f
commit 2687633941
2 changed files with 17 additions and 1 deletions

View File

@ -549,7 +549,7 @@ class Telegram(RPCHandler):
r['exit_reason'] = r.get('exit_reason', "")
lines = [
"*Trade ID:* `{trade_id}`" +
("` (since {open_date_hum})`" if r['is_open'] else ""),
(" `(since {open_date_hum})`" if r['is_open'] else ""),
"*Current Pair:* {pair}",
"*Direction:* " + ("`Short`" if r.get('is_short') else "`Long`"),
"*Leverage:* `{leverage}`" if r.get('leverage') else "",

View File

@ -364,6 +364,22 @@ def test_status_handle(default_conf, update, ticker, fee, mocker) -> None:
assert msg_mock.call_count == 2
assert 'LTC/BTC' in msg_mock.call_args_list[0][0][0]
mocker.patch('freqtrade.rpc.telegram.MAX_MESSAGE_LENGTH', 500)
msg_mock.reset_mock()
context = MagicMock()
context.args = ["2"]
telegram._status(update=update, context=context)
assert msg_mock.call_count == 2
msg1 = msg_mock.call_args_list[0][0][0]
msg2 = msg_mock.call_args_list[1][0][0]
assert 'Close Rate' not in msg1
assert 'Trade ID:* `2`' in msg1
assert 'Trade ID:* `2` - continued' in msg2
def test_status_table_handle(default_conf, update, ticker, fee, mocker) -> None:
mocker.patch.multiple(