@@ -288,8 +288,7 @@ def test_create_uri_userdata_reverse_false_com(self):
288
288
self .assertFalse (self .__class__ .ubwa .create_websocket_uri (["arr" ], ["!userData" ]))
289
289
290
290
def test_create_uri_userdata_regular_com (self ):
291
- if (len (self .__class__ .binance_com_testnet_api_key ) == 0 or
292
- len (self .__class__ .binance_com_testnet_api_secret ) == 0 ):
291
+ if BINANCE_COM_TESTNET_API_KEY is not None and BINANCE_COM_TESTNET_API_SECRET is not None :
293
292
print ("\r \n empty API key and/or secret: can not successfully test test_create_uri_userdata_regular_com() "
294
293
"for binance.com-testnet" )
295
294
else :
@@ -302,8 +301,7 @@ def test_create_uri_userdata_regular_com(self):
302
301
r'wss://testnet.binance.vision/ws/.' )
303
302
304
303
def test_create_uri_userdata_reverse_com (self ):
305
- if (len (self .__class__ .binance_com_testnet_api_key ) == 0 or
306
- len (self .__class__ .binance_com_testnet_api_secret ) == 0 ):
304
+ if BINANCE_COM_TESTNET_API_KEY is not None and BINANCE_COM_TESTNET_API_SECRET is not None :
307
305
print ("\r \n empty API key and/or secret: can not successfully test test_create_uri_userdata_reverse_com() "
308
306
"for binance.com-testnet" )
309
307
else :
@@ -367,50 +365,62 @@ def tearDownClass(cls):
367
365
print (f"TestBinanceOrgManager stopping:" )
368
366
369
367
def test_create_uri_alltickers_regular_org_subscribe (self ):
368
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_alltickers_regular_org_subscribe:" )
370
369
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["$all" ], ["allTickers" ]),
371
370
'wss://dex.binance.org/api/ws/$all@allTickers' )
372
371
373
372
def test_create_uri_alltickers_reverse_org_subscribe (self ):
373
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_alltickers_reverse_org_subscribe:" )
374
374
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["allTickers" ], ["$all" ]),
375
375
'wss://dex.binance.org/api/ws/$all@allTickers' )
376
376
377
377
def test_create_uri_allminitickers_regular_org_subscribe (self ):
378
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_allminitickers_regular_org_subscribe:" )
378
379
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["$all" ], ["allMiniTickers" ]),
379
380
'wss://dex.binance.org/api/ws/$all@allMiniTickers' )
380
381
381
382
def test_create_uri_allminitickers_reverse_org_subscribe (self ):
383
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_allminitickers_reverse_org_subscribe:" )
382
384
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["allMiniTickers" ], ["$all" ]),
383
385
'wss://dex.binance.org/api/ws/$all@allMiniTickers' )
384
386
385
387
def test_create_uri_blockheight_regular_org_subscribe (self ):
388
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_blockheight_regular_org_subscribe:" )
386
389
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["$all" ], ["blockheight" ]),
387
390
'wss://dex.binance.org/api/ws/$all@blockheight' )
388
391
389
392
def test_create_uri_blockheight_reverse_org_subscribe (self ):
393
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_blockheight_reverse_org_subscribe:" )
390
394
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["blockheight" ], ["$all" ]),
391
395
'wss://dex.binance.org/api/ws/$all@blockheight' )
392
396
393
397
def test_create_uri_single_trades_org_subscribe (self ):
398
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_single_trades_org_subscribe:" )
394
399
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["trades" ], ["RAVEN-F66_BNB" ]),
395
400
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@trades' )
396
401
397
402
def test_create_uri_single_marketdepth_org_subscribe (self ):
403
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_single_marketdepth_org_subscribe:" )
398
404
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["marketDepth" ], ["RAVEN-F66_BNB" ]),
399
405
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@marketDepth' )
400
406
401
407
def test_create_uri_single_kline_1h_org_subscribe (self ):
408
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_single_kline_1h_org_subscribe:" )
402
409
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["kline_1h" ], ["RAVEN-F66_BNB" ]),
403
410
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@kline_1h' )
404
411
405
412
def test_create_uri_single_ticker_org_subscribe (self ):
413
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_single_ticker_org_subscribe:" )
406
414
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["ticker" ], ["RAVEN-F66_BNB" ]),
407
415
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@ticker' )
408
416
409
417
def test_create_uri_single_miniTicker_org_subscribe (self ):
418
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_single_miniTicker_org_subscribe:" )
410
419
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (["miniTicker" ], ["RAVEN-F66_BNB" ]),
411
420
'wss://dex.binance.org/api/ws/RAVEN-F66_BNB@miniTicker' )
412
421
413
422
def test_create_uri_multi_org_subscribe (self ):
423
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_multi_org_subscribe:" )
414
424
self .assertEqual (self .__class__ .ubwa .create_websocket_uri (['trades' , 'kline_1h' ],
415
425
['RAVEN-F66_BNB' , 'ANKR-E97_BNB' ]),
416
426
'wss://dex.binance.org/api/ws' )
@@ -424,24 +434,28 @@ def test_create_uri_multi_org_subscribe(self):
424
434
"{'method': 'subscribe', 'topic': 'kline_1h', 'symbols': ['RAVEN-F66_BNB', 'ANKR-E97_BNB']}]" )
425
435
426
436
def test_create_uri_user_address_orders_single_org_subscribe (self ):
437
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_user_address_orders_single_org_subscribe:" )
427
438
self .assertEqual (
428
439
self .__class__ .ubwa .create_websocket_uri ('orders' ,
429
440
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6' ),
430
441
'wss://dex.binance.org/api/ws/bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6' )
431
442
432
443
def test_create_uri_user_address_accounts_single_org_subscribe (self ):
444
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_user_address_accounts_single_org_subscribe:" )
433
445
self .assertEqual (
434
446
self .__class__ .ubwa .create_websocket_uri ('accounts' ,
435
447
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6' ),
436
448
'wss://dex.binance.org/api/ws/bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6' )
437
449
438
450
def test_create_uri_user_address_transfers_single_org_subscribe (self ):
451
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_user_address_transfers_single_org_subscribe:" )
439
452
self .assertEqual (
440
453
self .__class__ .ubwa .create_websocket_uri ('transfers' ,
441
454
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6' ),
442
455
'wss://dex.binance.org/api/ws/bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6' )
443
456
444
457
def test_create_uri_user_address_multi_org_subscribe (self ):
458
+ print (f"\r \n TestBinanceOrgManager->test_create_uri_user_address_multi_org_subscribe:" )
445
459
stream_id = self .__class__ .ubwa .create_stream (['orders' , 'transfers' , 'accounts' ],
446
460
'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6' )
447
461
payload = self .__class__ .ubwa .create_payload (stream_id , 'subscribe' ,
@@ -456,12 +470,14 @@ def test_create_uri_user_address_multi_org_subscribe(self):
456
470
"'address': 'bnb1v566f3avl2ud5z0jepazsrguzkj367snlx4jm6'}]" )
457
471
458
472
def test_create_misc_single_org_subscribe (self ):
473
+ print (f"\r \n TestBinanceOrgManager->test_create_misc_single_org_subscribe:" )
459
474
stream_id = self .__class__ .ubwa .create_stream (["trades" ], ["RAVEN-F66_BNB" ])
460
475
payload = self .__class__ .ubwa .create_payload (stream_id , 'subscribe' , ['trades' ], 'RAVEN-F66_BNB' )
461
476
self .assertEqual (str (payload ),
462
477
"[{'method': 'subscribe', 'topic': 'trades', 'symbols': ['RAVEN-F66_BNB']}]" )
463
478
464
479
def test_create_misc_multi_org_subscribe (self ):
480
+ print (f"\r \n TestBinanceOrgManager->test_create_misc_multi_org_subscribe:" )
465
481
stream_id = self .__class__ .ubwa .create_stream (["trades" , 'kline_1m' ], ["RAVEN-F66_BNB" , "ANKR-E97_BNB" ])
466
482
payload = self .__class__ .ubwa .create_payload (stream_id , 'subscribe' ,
467
483
["trades" , 'kline_1m' ],
@@ -471,6 +487,7 @@ def test_create_misc_multi_org_subscribe(self):
471
487
"{'method': 'subscribe', 'topic': 'kline_1m', 'symbols': ['RAVEN-F66_BNB', 'ANKR-E97_BNB']}]" )
472
488
473
489
def test_create_misc_multi_org_unsubscribe (self ):
490
+ print (f"\r \n TestBinanceOrgManager->test_create_misc_multi_org_unsubscribe:" )
474
491
stream_id = self .__class__ .ubwa .create_stream (["trades" , 'kline_1m' ], ["RAVEN-F66_BNB" , "ANKR-E97_BNB" ])
475
492
payload = self .__class__ .ubwa .create_payload (stream_id , 'unsubscribe' ,
476
493
["trades" , 'kline_1m' ],
@@ -481,19 +498,23 @@ def test_create_misc_multi_org_unsubscribe(self):
481
498
"{'method': 'unsubscribe', 'topic': 'kline_1m'}]" )
482
499
483
500
def test_create_misc_single_org_unsubscribe (self ):
501
+ print (f"\r \n TestBinanceOrgManager->test_create_misc_single_org_unsubscribe:" )
484
502
stream_id = self .__class__ .ubwa .create_stream (["trades" ], ["RAVEN-F66_BNB" ])
485
503
payload = self .__class__ .ubwa .create_payload (stream_id , 'unsubscribe' , ["trades" ], ["RAVEN-F66_BNB" ])
486
504
self .assertEqual (str (payload ),
487
505
"[{'method': 'unsubscribe', 'symbols': ['RAVEN-F66_BNB']}, "
488
506
"{'method': 'unsubscribe', 'topic': 'trades'}]" )
489
507
490
508
def test_is_exchange_type_cex (self ):
509
+ print (f"\r \n TestBinanceOrgManager->test_is_exchange_type_cex:" )
491
510
self .assertEqual (self .__class__ .ubwa .is_exchange_type ("cex" ), False )
492
511
493
512
def test_is_exchange_type_dex (self ):
513
+ print (f"\r \n TestBinanceOrgManager->test_is_exchange_type_dex:" )
494
514
self .assertEqual (self .__class__ .ubwa .is_exchange_type ("dex" ), True )
495
515
496
516
def test_create_payload (self ):
517
+ print (f"\r \n TestBinanceOrgManager->test_create_payload:" )
497
518
result = "[{'method': 'subscribe', 'topic': 'kline_1m', 'symbols': ['RAVEN-F66_BNB']}]"
498
519
stream_id = self .__class__ .ubwa .get_new_uuid_id ()
499
520
self .assertEqual (str (self .__class__ .ubwa .create_payload (stream_id ,
@@ -503,6 +524,7 @@ def test_create_payload(self):
503
524
result )
504
525
505
526
def test_z_stop_manager (self ):
527
+ print (f"\r \n TestBinanceOrgManager->test_z_stop_manager:" )
506
528
self .__class__ .ubwa .stop_manager ()
507
529
508
530
class TestWSApiLive (unittest .TestCase ):
0 commit comments