From 17404e64ea852b02e24141cbf2514519541c84bf Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Sun, 5 Jan 2025 23:09:20 +0100 Subject: [PATCH] [Tests] update exchange leverage tests --- .../abstract_authenticated_future_exchange_tester.py | 8 +++++--- additional_tests/exchanges_tests/test_kucoin_futures.py | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py b/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py index d6ab6805d..38d5bef44 100644 --- a/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py +++ b/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py @@ -33,7 +33,6 @@ class AbstractAuthenticatedFutureExchangeTester( INVERSE_SYMBOL = None MIN_PORTFOLIO_SIZE = 2 # ensure fetching currency for linear and inverse SUPPORTS_GET_LEVERAGE = True - SUPPORTS_SET_LEVERAGE = True SUPPORTS_EMPTY_POSITION_SET_MARGIN_TYPE = True async def test_get_empty_linear_and_inverse_positions(self): @@ -85,9 +84,12 @@ async def inner_test_get_and_set_leverage(self): assert origin_leverage != trading_constants.ZERO if self.SUPPORTS_GET_LEVERAGE: assert origin_leverage == await self.get_leverage() - if not self.SUPPORTS_SET_LEVERAGE: - return new_leverage = origin_leverage + 1 + if not self.exchange_manager.exchange.UPDATE_LEVERAGE_FROM_API: + # can't set from api: make sure of that + with pytest.raises(trading_errors.NotSupported): + await self.exchange_manager.exchange.connector.set_symbol_leverage(self.SYMBOL, float(new_leverage)) + return await self.set_leverage(new_leverage) await self._check_margin_type_and_leverage(origin_margin_type, new_leverage) # did not change margin type # change leverage back to origin value diff --git a/additional_tests/exchanges_tests/test_kucoin_futures.py b/additional_tests/exchanges_tests/test_kucoin_futures.py index a26b66a5d..ef6ed0e18 100644 --- a/additional_tests/exchanges_tests/test_kucoin_futures.py +++ b/additional_tests/exchanges_tests/test_kucoin_futures.py @@ -33,7 +33,6 @@ class TestKucoinFuturesAuthenticatedExchange( INVERSE_SYMBOL = f"{ORDER_CURRENCY}/USD:{ORDER_CURRENCY}" ORDER_SIZE = 5 # % of portfolio to include in test orders SUPPORTS_GET_LEVERAGE = False - SUPPORTS_SET_LEVERAGE = False USE_ORDER_OPERATION_TO_CHECK_API_KEY_RIGHTS = True VALID_ORDER_ID = "6617e84c5c1e0000083c71f7" EXPECT_MISSING_FEE_IN_CANCELLED_ORDERS = False