diff --git a/freqtrade/exchange/okx.py b/freqtrade/exchange/okx.py index 7c3408fd7..a0fbb6729 100644 --- a/freqtrade/exchange/okx.py +++ b/freqtrade/exchange/okx.py @@ -1,6 +1,6 @@ import logging from datetime import timedelta -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Dict, List, Optional, Tuple import ccxt diff --git a/tests/exchange/test_okx.py b/tests/exchange/test_okx.py index 6ed24cd62..1bf783daa 100644 --- a/tests/exchange/test_okx.py +++ b/tests/exchange/test_okx.py @@ -552,6 +552,7 @@ def test__set_leverage_okx(mocker, default_conf): @pytest.mark.usefixtures("init_persistence") def test_fetch_stoploss_order_okx(default_conf, mocker): default_conf["dry_run"] = False + mocker.patch("freqtrade.exchange.common.time.sleep") api_mock = MagicMock() api_mock.fetch_order = MagicMock() @@ -570,10 +571,10 @@ def test_fetch_stoploss_order_okx(default_conf, mocker): with pytest.raises(RetryableOrderError): exchange.fetch_stoploss_order("1234", "ETH/BTC") - assert api_mock.fetch_order.call_count == 1 - assert api_mock.fetch_open_orders.call_count == 1 - assert api_mock.fetch_closed_orders.call_count == 1 - assert api_mock.fetch_canceled_orders.call_count == 1 + assert api_mock.fetch_order.call_count == API_RETRY_COUNT + 1 + assert api_mock.fetch_open_orders.call_count == API_RETRY_COUNT + 1 + assert api_mock.fetch_closed_orders.call_count == API_RETRY_COUNT + 1 + assert api_mock.fetch_canceled_orders.call_count == API_RETRY_COUNT + 1 api_mock.fetch_order.reset_mock() api_mock.fetch_open_orders.reset_mock()