tests: update test for retryable okx behavior

This commit is contained in:
Matthias
2024-09-24 20:24:54 +02:00
parent 0a68b0515c
commit 28eabfe477
2 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import logging import logging
from datetime import timedelta from datetime import timedelta
from typing import Any, Dict, List, Optional, Tuple, Union from typing import Any, Dict, List, Optional, Tuple
import ccxt import ccxt

View File

@@ -552,6 +552,7 @@ def test__set_leverage_okx(mocker, default_conf):
@pytest.mark.usefixtures("init_persistence") @pytest.mark.usefixtures("init_persistence")
def test_fetch_stoploss_order_okx(default_conf, mocker): def test_fetch_stoploss_order_okx(default_conf, mocker):
default_conf["dry_run"] = False default_conf["dry_run"] = False
mocker.patch("freqtrade.exchange.common.time.sleep")
api_mock = MagicMock() api_mock = MagicMock()
api_mock.fetch_order = MagicMock() api_mock.fetch_order = MagicMock()
@@ -570,10 +571,10 @@ def test_fetch_stoploss_order_okx(default_conf, mocker):
with pytest.raises(RetryableOrderError): with pytest.raises(RetryableOrderError):
exchange.fetch_stoploss_order("1234", "ETH/BTC") exchange.fetch_stoploss_order("1234", "ETH/BTC")
assert api_mock.fetch_order.call_count == 1 assert api_mock.fetch_order.call_count == API_RETRY_COUNT + 1
assert api_mock.fetch_open_orders.call_count == 1 assert api_mock.fetch_open_orders.call_count == API_RETRY_COUNT + 1
assert api_mock.fetch_closed_orders.call_count == 1 assert api_mock.fetch_closed_orders.call_count == API_RETRY_COUNT + 1
assert api_mock.fetch_canceled_orders.call_count == 1 assert api_mock.fetch_canceled_orders.call_count == API_RETRY_COUNT + 1
api_mock.fetch_order.reset_mock() api_mock.fetch_order.reset_mock()
api_mock.fetch_open_orders.reset_mock() api_mock.fetch_open_orders.reset_mock()