Index: shared/scripts/configuration/config.py =================================================================== diff -u -r56d3408e2bce20bdbaad525bc91388fbc0130ccd -r94e535b209b30b9aaae8174e92ea802f4a6c5452 --- shared/scripts/configuration/config.py (.../config.py) (revision 56d3408e2bce20bdbaad525bc91388fbc0130ccd) +++ shared/scripts/configuration/config.py (.../config.py) (revision 94e535b209b30b9aaae8174e92ea802f4a6c5452) @@ -34,6 +34,7 @@ BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" EPOCH_INDEX = 0 +SEQUENCE_INDEX = 1 CRC_INDEX = 2 CODE_INDEX = 3 PARAMETER_COUNT = 4 @@ -43,4 +44,3 @@ ACK_BAK_STATUS = 'Ack Bak' - Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rd2576094b112afa907b4ab03f3a21a1bfd193c0b -r94e535b209b30b9aaae8174e92ea802f4a6c5452 --- shared/scripts/configuration/utility.py (.../utility.py) (revision d2576094b112afa907b4ab03f3a21a1bfd193c0b) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 94e535b209b30b9aaae8174e92ea802f4a6c5452) @@ -14,7 +14,6 @@ import test import csv -import squish import os from datetime import datetime @@ -28,14 +27,20 @@ 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") @@ -50,9 +55,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") @@ -64,9 +69,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") @@ -101,16 +106,18 @@ 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 Index: tst_cloud_sync - treatment_screen/test.py =================================================================== diff -u -rd2576094b112afa907b4ab03f3a21a1bfd193c0b -r94e535b209b30b9aaae8174e92ea802f4a6c5452 --- tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision d2576094b112afa907b4ab03f3a21a1bfd193c0b) +++ tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision 94e535b209b30b9aaae8174e92ea802f4a6c5452) @@ -77,10 +77,11 @@ """ test.startSection("Verification of cloud response for code %s" %actual_cloudsync_data[config.CODE_INDEX]) expected_cloudsync_data = expected_cloudsync_data.split(',') - current_epoch_value = int(time.time()) + current_epoch_value = time.time() epoch_value_status = utility.get_epoch_value_consistancy(current_epoch_value, actual_cloudsync_data[config.EPOCH_INDEX]) test.verify(epoch_value_status, "epoch value should be in range and it is verified") + for index in (config.CRC_INDEX, config.CODE_INDEX, config.PARAMETER_COUNT, config.PARAMETER_INDEX): test.compare(expected_cloudsync_data[index], actual_cloudsync_data[index], "cloud sync data %s is verified" %expected_cloudsync_data[index]) test.endSection() @@ -96,11 +97,9 @@ startApplication(config.AUT_NAME) utils.waitForGUI(1.5) - set_data_in_cloud_sync_output_file(CODE_DISPLAY_REQUEST) verify_code_from_treatment_response() - set_data_in_cloud_sync_output_file(DEVICE_CREDENTIALS_REQUEST) utils.waitForGUI(3) device_credentials_response = utility.retrive_log_data()