Index: tst_cloud_sync - treatment_screen/test.py =================================================================== diff -u -rbf98ed485921dcfa4ae44169eaba81cc6d1e0325 -r710c198d30c8c4479ba1006f637441dce1f9a46f --- tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision bf98ed485921dcfa4ae44169eaba81cc6d1e0325) +++ tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision 710c198d30c8c4479ba1006f637441dce1f9a46f) @@ -258,38 +258,7 @@ test.fail("err log file is not created or log file is not created based on standard log naming format.") -def rename_file(path,filename): - """ - This method Rename the original folder name to dummy name. - """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename+"_1": - if os.path.exists(path+filename+"_1"): - shutil.rmtree(path+filename+"_1") - test.log(str(filename+" name changed to "+files)) - if files == filename: - if os.path.exists(path+filename): - utils.waitForGUI(1) - os.rename(path+filename,path+filename+"_1") - test.log(str(files+" name changed to "+filename+"_1")) -def rename_old_name(path,filename): - """ - This method Rename the dummy name to original folder name . - """ - folder_path = os.listdir(path) - for files in folder_path: - if files == filename: - if os.path.exists(path+filename): - shutil.rmtree(path+filename) - test.log(str(files+"_1 name changed to "+filename)) - utils.waitForGUI(5) - if files != filename: - if (files == filename+"_1"): - os.rename(path+files,path+filename) - test.log(str(files+" name changed to "+filename)) - def verify_wifi_scan(): """ Method to navigate to "Settings" screen @@ -317,40 +286,40 @@ test.startSection("Renaming the cloudsync,sd-card, usb-disk, application folder name") try: - rename_file(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_file(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") utils.waitForGUI(5) except: test.log(str("cloudsync main desktop folder name not changed")) finally: - rename_old_name(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_old_name(config.SD_CARD_CLOUDSYNC_FOLDER_PATH,"cloudsync") try: - rename_file(config.SD_CARD_LOCATION,"sd-card") + utility.rename_file(config.SD_CARD_LOCATION,"sd-card") utils.waitForGUI(5) except: test.log(str("sd-card folder name not changed")) finally: - rename_old_name(config.SD_CARD_LOCATION,"sd-card") + utility.rename_old_name(config.SD_CARD_LOCATION,"sd-card") try: - rename_file(config.USB_DISK_FOLDER_LOCATION,"usb-disk") + utility.rename_file(config.USB_DISK_FOLDER_LOCATION,"usb-disk") utils.waitForGUI(5) except: test.log(str("usb_disk folder name not changed")) finally: - rename_old_name(config.USB_DISK_FOLDER_LOCATION,"usb-disk") + utility.rename_old_name(config.USB_DISK_FOLDER_LOCATION,"usb-disk") try: - rename_file(config.APPLICATION_FOLDER_LOCATION,"application") + utility.rename_file(config.APPLICATION_FOLDER_LOCATION,"application") utils.waitForGUI(5) verify_wifi_scan() except: test.log(str("Setings wifi screen not visible")) finally: - rename_old_name(config.APPLICATION_FOLDER_LOCATION,"application") + utility.rename_old_name(config.APPLICATION_FOLDER_LOCATION,"application") try: - rename_file(config.CANBUS_FOLDER_LOCATION,"canbus") + utility.rename_file(config.CANBUS_FOLDER_LOCATION,"canbus") HD_DG_VERSION_SERIAL_REQUEST = "1657706421,13,0,1001,3,HD1234567890123,DG1234567890123,06300216" hd_simulator.cmd_send_serial_hd_data(serial = HD_VERSION_SERIAL_REQUEST[5]) dg_simulator.cmd_send_serial_dg_data(serial = DG_VERSION_SERIAL_REQUEST[6]) @@ -359,7 +328,7 @@ except: test.log(str("Setings wifi screen not visible")) finally: - rename_old_name(config.CANBUS_FOLDER_LOCATION,"canbus") + utility.rename_old_name(config.CANBUS_FOLDER_LOCATION,"canbus") test.endSection() def verify_cloudsync_treatment(): @@ -402,9 +371,20 @@ def main(): + """ + Do not interrupt this script while it is executing. + This script might create folder problems. + Inside this script we are renaming names of following folders which are required for execution. + 1)cloudsync present on desktop + 2)cloudsync present inside sd-card + 3)usb-disk + 4)sd-card + 5)application + 6)canbus + """ utils.tstStart(__file__) try: - rename_file(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_file(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") utils.waitForGUI(0.5) startApplication(config.AUT_NAME) utils.waitForGUI(1.5) @@ -416,7 +396,7 @@ except: test.log(str("Cloudsync desktop folder name not changed")) finally: - rename_old_name(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") + utility.rename_old_name(config.CLOUDSYNC_FOLDER_PATH,"cloudsync") verify_cloudsync_treatment() rename_folder_names()