From 85772ac7f7c7306ebc361b9997a4e33b573042c5 Mon Sep 17 00:00:00 2001 From: Axel-CH Date: Sun, 23 Mar 2025 00:27:52 -0400 Subject: [PATCH] test: update stopentry related tests for rpc api and telegram --- tests/rpc/test_rpc_apiserver.py | 11 ++++++----- tests/rpc/test_rpc_telegram.py | 9 +++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 99d8350e9..5f4c84db2 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -535,21 +535,22 @@ def test_api_reloadconf(botclient): def test_api_stopentry(botclient): ftbot, client = botclient - assert ftbot.config["max_open_trades"] != 0 + + rc = client_post(client, f"{BASE_URI}/stopbuy") + assert_response(rc) + assert rc.json() == {"status": "pausing trader ..."} rc = client_post(client, f"{BASE_URI}/stopbuy") assert_response(rc) assert rc.json() == { - "status": "No more entries will occur from now. Run /reload_config to reset." + "status": "No more entries will occur from now. Run /start to enable entries." } - assert ftbot.config["max_open_trades"] == 0 rc = client_post(client, f"{BASE_URI}/stopentry") assert_response(rc) assert rc.json() == { - "status": "No more entries will occur from now. Run /reload_config to reset." + "status": "No more entries will occur from now. Run /start to enable entries." } - assert ftbot.config["max_open_trades"] == 0 def test_api_balance(botclient, mocker, rpc_balance, tickers): diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 398bd5262..e2e0137af 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -1225,14 +1225,11 @@ async def test_stop_handle_already_stopped(default_conf, update, mocker) -> None async def test_stopbuy_handle(default_conf, update, mocker) -> None: telegram, freqtradebot, msg_mock = get_telegram_testobject(mocker, default_conf) - assert freqtradebot.config["max_open_trades"] != 0 + assert freqtradebot.state == State.RUNNING await telegram._stopentry(update=update, context=MagicMock()) - assert freqtradebot.config["max_open_trades"] == 0 + assert freqtradebot.state == State.PAUSED assert msg_mock.call_count == 1 - assert ( - "No more entries will occur from now. Run /reload_config to reset." - in msg_mock.call_args_list[0][0][0] - ) + assert "pausing trader ..." in msg_mock.call_args_list[0][0][0] async def test_reload_config_handle(default_conf, update, mocker) -> None: