Test iterative sending of /status
This commit is contained in:
parent
b12dd15f4f
commit
2687633941
@ -549,7 +549,7 @@ class Telegram(RPCHandler):
|
|||||||
r['exit_reason'] = r.get('exit_reason', "")
|
r['exit_reason'] = r.get('exit_reason', "")
|
||||||
lines = [
|
lines = [
|
||||||
"*Trade ID:* `{trade_id}`" +
|
"*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}",
|
"*Current Pair:* {pair}",
|
||||||
"*Direction:* " + ("`Short`" if r.get('is_short') else "`Long`"),
|
"*Direction:* " + ("`Short`" if r.get('is_short') else "`Long`"),
|
||||||
"*Leverage:* `{leverage}`" if r.get('leverage') else "",
|
"*Leverage:* `{leverage}`" if r.get('leverage') else "",
|
||||||
|
@ -364,6 +364,22 @@ def test_status_handle(default_conf, update, ticker, fee, mocker) -> None:
|
|||||||
assert msg_mock.call_count == 2
|
assert msg_mock.call_count == 2
|
||||||
assert 'LTC/BTC' in msg_mock.call_args_list[0][0][0]
|
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:
|
def test_status_table_handle(default_conf, update, ticker, fee, mocker) -> None:
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
|
Loading…
Reference in New Issue
Block a user