From f385e2c2b6adaa405d5ae111a324dc0b7ff56bf5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 9 Apr 2022 10:04:10 +0200 Subject: [PATCH] Update test to also cover "no trade found" scenario --- tests/rpc/test_rpc_telegram.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index bb863a004..de777d609 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -1235,13 +1235,18 @@ def test_force_exit_no_pair(default_conf, update, ticker, fee, mocker) -> None: patch_get_signal(freqtradebot) + # /forceexit + context = MagicMock() + context.args = [] + telegram._force_exit(update=update, context=context) + # No pair + assert msg_mock.call_args_list[0][1]['msg'] == 'No open trade found.' + # Create some test data freqtradebot.enter_positions() msg_mock.reset_mock() - # /forcesell all - context = MagicMock() - context.args = [] + # /forceexit telegram._force_exit(update=update, context=context) keyboard = msg_mock.call_args_list[0][1]['keyboard'] # 4 pairs + cancel @@ -1258,7 +1263,7 @@ def test_force_exit_no_pair(default_conf, update, ticker, fee, mocker) -> None: assert femock.call_count == 1 assert femock.call_args_list[0][0][0] == '2' - # Retry selling - but cancel instead + # Retry exiting - but cancel instead update.callback_query.reset_mock() telegram._force_exit(update=update, context=context) # Use cancel button