@@ -25,7 +25,7 @@ class TBClientPETests(unittest.TestCase):
2525 @classmethod
2626 def setUpClass (cls ) -> None :
2727 # ThingsBoard REST API URL
28- url = "https ://127.0.0.1:8080"
28+ url = "http ://127.0.0.1:8080"
2929
3030 # Default Tenant Administrator credentials
3131 username = "tenant@thingsboard.org"
@@ -56,8 +56,6 @@ def test_get_device_publish_telemetry_commands(self):
5656 self .assertIsInstance (self .client .get_device_publish_telemetry_commands (self .device .id ), dict )
5757
5858class AdminControllerTests (TBClientPETests ):
59- def test_get_authorization_url (self ):
60- self .assertIsInstance (self .client .get_authorization_url (), str )
6159
6260 def test_get_mail_processing_url (self ):
6361 self .assertIsInstance (self .client .get_mail_processing_url (), str )
@@ -386,7 +384,8 @@ def test_get_audit_logs_by_user_id(self):
386384
387385
388386class EntityGroupControllerTests (TBClientPETests ):
389- test_entity_group = None
387+ test_entity_group : EntityGroup = None
388+ asset_profile_id = None
390389 test_asset = None
391390 customer = None
392391 user = None
@@ -407,10 +406,14 @@ def setUpClass(cls) -> None:
407406 cls .test_entity_group = EntityGroup (name = 'Test 4' , type = 'ASSET' )
408407 cls .test_entity_group = cls .client .save_entity_group (cls .test_entity_group )
409408
410- cls .test_asset = cls .client .get_tenant_assets (10 , 0 ).data [0 ]
409+ cls .asset_profile_id = cls .client .get_default_asset_profile_info ().id
410+ cls .test_asset = Asset (name = "Test Asset" , asset_profile_id = cls .asset_profile_id )
411+ cls .test_asset = cls .client .save_asset (body = cls .test_asset ,
412+ entity_group_id = cls .test_entity_group .id )
411413
412414 @classmethod
413415 def tearDownClass (cls ) -> None :
416+ cls .client .delete_asset (cls .test_asset .id )
414417 cls .client .delete_entity_group (cls .test_entity_group .id )
415418 cls .client .delete_role (cls .role .id )
416419
@@ -457,7 +460,6 @@ def test_get_entity_group_by_id(self):
457460 self .client .get_entity_group_by_id (self .test_entity_group .id ),
458461 EntityGroupInfo )
459462
460- @unittest .skip ('ThingsBoard json naming bug' )
461463 def test_get_owners (self ):
462464 self .assertIsInstance (self .client .get_owners (1 , 0 ), PageDataContactBasedobject )
463465
@@ -466,17 +468,13 @@ def test_share_entity_group_to_child_owner_user_group(self):
466468 self .client .share_entity_group_to_child_owner_user_group (self .test_entity_group .id , self .user_group .id ,
467469 self .role .id ), None )
468470
469- @unittest .skip ('ThingsBoard json naming bug' )
470471 def test_get_entities (self ):
471- self .assertIsInstance (
472- self .client .get_entities (EntityGroupId ('4fe07130-edfd-11eb-91fd-1f8899a6f9b3' , 'ENTITY_GROUP' ), 10 , 0 ),
473- PageDataShortEntityView )
472+ self .assertIsInstance (self .client .get_entities (self .test_entity_group .id , 10 , 0 ),
473+ PageDataShortEntityView )
474474
475- @unittest .skip ('ThingsBoard json naming bug' )
476475 def test_get_group_entity (self ):
477- self .assertIsInstance (
478- self .client .get_group_entity (EntityGroupId ('4fe07130-edfd-11eb-91fd-1f8899a6f9b3' ),
479- EntityId ('7731eb20-1894-11ed-b864-31da2039250b' , 'ASSET' )), ShortEntityView )
476+ self .assertIsInstance (self .client .get_group_entity (self .test_entity_group .id , self .test_asset .id ),
477+ ShortEntityView )
480478
481479
482480class CustomerControllerTests (TBClientPETests ):
@@ -727,7 +725,7 @@ def test_ack_alarm(self):
727725
728726 def test_get_alarm_by_id (self ):
729727 self .assertIsInstance (self .client .get_alarm_by_id (self .test_alarm .id ), Alarm )
730-
728+
731729 def test_get_alarm_types_using_get (self ):
732730 self .assertIsInstance (self .client .get_alarm_types (10 , 0 ), PageDataEntitySubtype )
733731
0 commit comments