Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r94e535b209b30b9aaae8174e92ea802f4a6c5452 -rd2576094b112afa907b4ab03f3a21a1bfd193c0b --- shared/scripts/configuration/utility.py (.../utility.py) (revision 94e535b209b30b9aaae8174e92ea802f4a6c5452) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision d2576094b112afa907b4ab03f3a21a1bfd193c0b) @@ -14,6 +14,7 @@ import test import csv +import squish import os from datetime import datetime @@ -27,20 +28,14 @@ def get_current_date_and_time(date_format='%Y/%b/%d - %H:%M:%S'): - """ - Method to get current date and time. - @input date_format (str) - format of date to be retrieved. - @return (str) - date in specified format. - """ + date = datetime.now() return str(date.strftime(date_format)) + def append_cloudsync_credentials_file(): - """ - This function is used for creating .pem files in the cloudsync folder. - pem files is created on '/home/denali/Desktop/cloudsync/credentials' - """ + try: os.makedirs(CLOUD_CREDENTIALS_LOCATION, exist_ok = True) test.log("Directory created successfully") @@ -55,9 +50,9 @@ def get_cloud_sync_input_file(): """ - This function is the handler for getting file from log folder. - Application log file is automatically created on '/home/denali/Desktop/sd-card/cloudsync/ {current_date}_inp.log' - @return latest_file - (string) returns latest file that append on log folder from sd-data + This function is the handler for getting file from log folder. + Application log file is automatically created on '/home/denali/Desktop/sd-card/cloudsync/ {current_date}_inp.log' + @return latest_file - (string) returns latest file that append on log folder from sd-data """ try: current_date = get_current_date_and_time(date_format = "%Y_%m_%d") @@ -69,9 +64,9 @@ def get_cloud_sync_output_file(): """ - This function is the handler for getting file from log folder. - Application log file is automatically created on '/home/denali/Desktop/sd-card/cloudsync/ {current_date}_out.log' - @return latest_file - (string) returns latest file that append on log folder from sd-data + This function is the handler for getting file from log folder. + Application log file is automatically created on '/home/denali/Desktop/sd-card/cloudsync/ {current_date}_out.log' + @return latest_file - (string) returns latest file that append on log folder from sd-data """ try: current_date = get_current_date_and_time(date_format = "%Y_%m_%d") @@ -106,18 +101,16 @@ def get_epoch_value_consistancy(current_epoch_value, expected_epoch_value): - """ - This function is verify consistancy of epoch value. - @input current_epoch_value (float) - current epoch time - @input expected_epoch_value (str) - epoch time from the cloud-sync log. - @return (bool) - True/False - """ - expected_epoch_value = int(expected_epoch_value) - maximum_epoch_value = int(current_epoch_value + 25) - minimum_epoch_value = int(current_epoch_value - 25) + + maximum_epoch_value = current_epoch_value + 25 + minimum_epoch_value = current_epoch_value - 25 + test.log(str(current_epoch_value)) + test.log(str(expected_epoch_value)) if expected_epoch_value > minimum_epoch_value and expected_epoch_value < maximum_epoch_value : return True return False - \ No newline at end of file + + +