test: update stopentry related tests for rpc api and telegram

This commit is contained in:
Axel-CH
2025-03-23 00:27:52 -04:00
parent 3ec72f88e2
commit 85772ac7f7
2 changed files with 9 additions and 11 deletions

View File

@@ -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):

View File

@@ -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: