# -*- coding: utf-8 -*- ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_inhandled_message_log # date 2022/07/08 # author Shweta Policepatil # # # # NOTE: # This test verifies the cloud sync - Hd opmodes. import csv import os from dialin.ui.hd_simulator import HDSimulator from dialin.ui import utils from configuration import utility from configuration import config from dialin.common.hd_defs import HDOpModes, HDOpSubModes from dialin.utils.conversions import float_to_bytearray, integer_to_bytearray,unsigned_integer_to_bytearray hd_simulator = HDSimulator() CLOUD_CREDENTIALS_LOCATION = '/home/denali/Desktop/cloudsync/credentials' CLOUD_SYNC_LOG_LOCATION = '/home/denali/Desktop/sd-card/cloudsync' MESSAGE_1 = '1639391827,1,0,2008,1,Tx_code' PEM_FILES = ['1.pem', '2.pem', '3.pem' ] CLOUD_CREDENTIALS_LOCATION = '/home/denali/Desktop/cloudsync/credentials' CLOUD_SYNC_LOG_LOCATION = '/home/denali/Desktop/sd-card/cloudsync/' MESSAGE_1 = '1639391827,1,0,2008,1,Tx_code' PEM_FILES = ['1.pem', '2.pem', '3.pem' ] def append_cloudsync_credentials_file(): try: os.makedirs(CLOUD_CREDENTIALS_LOCATION, exist_ok = True) test.log("Directory created successfully") for file_handler in range(len(PEM_FILES)): path = os.path.join(CLOUD_CREDENTIALS_LOCATION, PEM_FILES[file_handler]) with open(path, 'w') as file_reader: pass except OSError as error: test.log("Directory can not be created") def navigate_to_hd_opmode_(): """ Method to navigate different hd opmodes to verify message id's logged in cloudsync """ test.startSection("Navigating to different hd opmodes to verify message id's") test.log("Fault mode") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_FAUL.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Service Screen") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Initial Screen") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_INIT.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Standby mode") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_STAN.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Treatment mode") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TPAR.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Pre- Treatment mode") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_PRET.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Treatment mode") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_TREA.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Post treatment Screen") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_POST.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Service Screen") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_SERV.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) utils.waitForGUI(1) test.log("Illegal trasition") hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_NLEG.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) # utils.waitForGUI(1) # hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.NUM_OF_MODES.value, sub_mode=HDOpSubModes.STANDBY_START_STATE.value) # test.endSection() def main(): append_cloudsync_credentials_file() utils.tstStart(__file__) startApplication(config.AUT_NAME) utils.waitForGUI(1.5) navigate_to_hd_opmode_()