@@ -122,6 +122,7 @@ def __init__(self, config_path="", autostart=True):
122122 self .current_test_suite = self .log .get_file_name ('testsuite' )
123123 self .restart_tss = False
124124 self .last_wa_tab_view_input_id = None
125+ self .mock_counter = 0
125126 self .mock_route = ''
126127 self .registry_endpoint = ''
127128 self .rac_endpoint = ''
@@ -11366,7 +11367,7 @@ def set_mock_route(self, route, sub_route, registry):
1136611367 self .mock_route = route + sub_route
1136711368 logger ().info (f'"{ self .mock_route } " route Was seted' )
1136811369
11369- if registry :
11370+ if registry :
1137011371
1137111372 if self .config .appserver_folder :
1137211373
@@ -11385,18 +11386,22 @@ def set_mock_route(self, route, sub_route, registry):
1138511386
1138611387 for key , value in registry_endpoints .items ():
1138711388 if config .has_option (self .config .environment , key ):
11388- if key == "fw-tf-registry-endpoint" and not self .registry_endpoint :
11389- self .registry_endpoint = value
11390- elif key == "fw-tf-rac-endpoint" and not self .rac_endpoint :
11391- self .rac_endpoint = value
11392- elif key == "fw-tf-platform-endpoint" and not self .platform_endpoint :
11393- self .platform_endpoint = value
11389+ if not self .mock_counter :
11390+ if key == "fw-tf-registry-endpoint" and not self .registry_endpoint :
11391+ self .registry_endpoint = config .get (self .config .environment , key )
11392+ elif key == "fw-tf-rac-endpoint" and not self .rac_endpoint :
11393+ self .rac_endpoint = config .get (self .config .environment , key )
11394+ elif key == "fw-tf-platform-endpoint" and not self .platform_endpoint :
11395+ self .platform_endpoint = config .get (self .config .environment , key )
11396+ config .set (self .config .environment , key , value )
1139411397 else :
1139511398 config .set (self .config .environment , key , value )
1139611399
1139711400 with open (appserver_file , "w" ) as configfile :
1139811401 config .write (configfile )
1139911402
11403+ self .mock_counter += 1
11404+
1140011405 logger ().info (f'Endpoints has been updated in .ini file!' )
1140111406
1140211407
@@ -11409,3 +11414,29 @@ def get_route_mock(self):
1140911414 """
1141011415 url = self .config .server_mock + self .mock_route
1141111416 return re .sub (r'(?<!:)//+' , '/' , url )
11417+
11418+
11419+ def rest_resgistry (self ):
11420+ """restore registry keys on appserver.ini file
11421+ """
11422+
11423+ if self .platform_endpoint :
11424+ registry_endpoints = {
11425+ "fw-tf-registry-endpoint" : f"{ self .registry_endpoint } /registry" ,
11426+ "fw-tf-rac-endpoint" : f"{ self .rac_endpoint } " ,
11427+ "fw-tf-platform-endpoint" : f"{ self .platform_endpoint } " ,
11428+ }
11429+
11430+ config = configparser .ConfigParser ()
11431+ appserver_file = self .replace_slash (f'{ self .config .appserver_folder } \\ appserver.ini' )
11432+
11433+ config .read (appserver_file )
11434+
11435+ for key , value in registry_endpoints .items ():
11436+ if config .has_option (self .config .environment , key ):
11437+ config .set (self .config .environment , key , value )
11438+
11439+ with open (appserver_file , "w" ) as configfile :
11440+ config .write (configfile )
11441+
11442+ logger ().info (f'Endpoints has been restored in .ini file.' )
0 commit comments