@@ -86,6 +86,7 @@ class AbstractAuthenticatedExchangeTester:
8686 EXPECTED_INVALID_ORDERS_QUANTITY = [] # orders with known invalid quantity exchange order id (usually legacy)
8787 CHECK_EMPTY_ACCOUNT = False # set True when the account to check has no funds. Warning: does not check order
8888 # parse/create/fill/cancel or portfolio & trades parsing
89+ IS_BROKER_ENABLED_ACCOUNT = True # set False when this test account can't generate broker fees
8990
9091 # Implement all "test_[name]" methods, call super() to run the test, pass to ignore it.
9192 # Override the "inner_test_[name]" method to override a test content.
@@ -209,6 +210,21 @@ async def inner_test_get_not_found_order(self):
209210 non_existing_order = await self .exchange_manager .exchange .get_order (self .VALID_ORDER_ID , self .SYMBOL )
210211 assert non_existing_order is None
211212
213+ async def test_is_valid_account (self ):
214+ async with self .local_exchange_manager ():
215+ await self .inner_test_is_valid_account ()
216+
217+ async def inner_test_is_valid_account (self ):
218+ is_compatible , error = await self .exchange_manager .exchange_backend .is_valid_account (
219+ always_check_key_rights = True
220+ )
221+ assert is_compatible is self .IS_BROKER_ENABLED_ACCOUNT
222+ if is_compatible :
223+ assert error is None
224+ else :
225+ assert isinstance (error , str )
226+ assert len (error ) > 0
227+
212228 async def test_create_and_cancel_limit_orders (self ):
213229 async with self .local_exchange_manager ():
214230 await self .inner_test_create_and_cancel_limit_orders ()
0 commit comments