mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 04:03:55 +00:00
tests: add test for #10704
This commit is contained in:
parent
5907de90c1
commit
3d1acc65af
|
@ -6,6 +6,7 @@ import pytest
|
||||||
|
|
||||||
from freqtrade.enums import CandleType, MarginMode, TradingMode
|
from freqtrade.enums import CandleType, MarginMode, TradingMode
|
||||||
from freqtrade.exceptions import RetryableOrderError, TemporaryError
|
from freqtrade.exceptions import RetryableOrderError, TemporaryError
|
||||||
|
from freqtrade.exchange.common import API_FETCH_ORDER_RETRY_COUNT
|
||||||
from freqtrade.exchange.exchange import timeframe_to_minutes
|
from freqtrade.exchange.exchange import timeframe_to_minutes
|
||||||
from tests.conftest import EXMS, get_patched_exchange, log_has
|
from tests.conftest import EXMS, get_patched_exchange, log_has
|
||||||
from tests.exchange.test_exchange import ccxt_exceptionhandlers
|
from tests.exchange.test_exchange import ccxt_exceptionhandlers
|
||||||
|
@ -610,6 +611,39 @@ def test_fetch_stoploss_order_okx(default_conf, mocker):
|
||||||
assert dro_mock.call_count == 1
|
assert dro_mock.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_fetch_stoploss_order_okx_exceptions(default_conf_usdt, mocker):
|
||||||
|
default_conf_usdt["dry_run"] = False
|
||||||
|
api_mock = MagicMock()
|
||||||
|
ccxt_exceptionhandlers(
|
||||||
|
mocker,
|
||||||
|
default_conf_usdt,
|
||||||
|
api_mock,
|
||||||
|
"okx",
|
||||||
|
"fetch_stoploss_order",
|
||||||
|
"fetch_order",
|
||||||
|
retries=API_FETCH_ORDER_RETRY_COUNT + 1,
|
||||||
|
order_id="12345",
|
||||||
|
pair="ETH/USDT",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Test 2nd part of the function
|
||||||
|
api_mock.fetch_order = MagicMock(side_effect=ccxt.OrderNotFound())
|
||||||
|
api_mock.fetch_closed_orders = MagicMock(return_value=[])
|
||||||
|
api_mock.fetch_canceled_orders = MagicMock(return_value=[])
|
||||||
|
|
||||||
|
ccxt_exceptionhandlers(
|
||||||
|
mocker,
|
||||||
|
default_conf_usdt,
|
||||||
|
api_mock,
|
||||||
|
"okx",
|
||||||
|
"fetch_stoploss_order",
|
||||||
|
"fetch_open_orders",
|
||||||
|
retries=API_FETCH_ORDER_RETRY_COUNT + 1,
|
||||||
|
order_id="12345",
|
||||||
|
pair="ETH/USDT",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"sl1,sl2,sl3,side", [(1501, 1499, 1501, "sell"), (1499, 1501, 1499, "buy")]
|
"sl1,sl2,sl3,side", [(1501, 1499, 1501, "sell"), (1499, 1501, 1499, "buy")]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user