Index: tst_unhandled_message_log/test.py =================================================================== diff -u -r6a9444c4619a3fcd3fbfad05763e89e439baf345 -re42cd503b84403da167a606ef0d3b8ae48093e0f --- tst_unhandled_message_log/test.py (.../test.py) (revision 6a9444c4619a3fcd3fbfad05763e89e439baf345) +++ tst_unhandled_message_log/test.py (.../test.py) (revision e42cd503b84403da167a606ef0d3b8ae48093e0f) @@ -35,8 +35,13 @@ DUMMY_UNSIGNED_INT_VALUE = 5 UNHANDLED_MESSAGE = { - 'MESSAGE_1' : "\n[0xBB00]\nHD_custom_data_verification_1\nU32=unsigned_32bit\nU32=argument_2\n", - 'MESSAGE_2' : "\n[0xAA00]\nHD_custom_data_verification_2\nF32=float_argument\nS32=argument_2\n" + 'MESSAGE_1' : "\n[0xBB00]\nHD_custom_data_verification_1\nU32=unsigned_32bit\nU32=unsigned_int\n", + 'MESSAGE_2' : "\n[0xAA00]\nHD_custom_data_verification_2\nF32=float_argument\nS32=string\n", + 'MESSAGE_3' : "\n[0xCC00]\nHD_custom_data_verification_3\nS32=string_argument\nS32=string\n", + 'MESSAGE_4' : "\n[0xDD00]\nHD_custom_data_verification_4\nS16string_argument\nS16=string\n", + 'MESSAGE_5' : "\n[0xEE00]\nHD_custom_data_verification_5\nU16=unsigned_int_argument\nu16=integer\n", + 'MESSAGE_6' : "\n[0xFF00]\nHD_custom_data_verification_6\nS08=string_argument\nS08=integer\n", + 'MESSAGE_7' : "\n[0xAF00]\nHD_custom_data_verification_7\nU08=unsigned_int_argument\nU08=integer\n" } ERROR_MESSAGE = { "0x1300" : "Incorrect data length (9 of 32) for received Message with ID '0x1300'", @@ -129,6 +134,11 @@ with open(LOCATION, "a") as filereader: filereader.write(UNHANDLED_MESSAGE['MESSAGE_1']) filereader.write(UNHANDLED_MESSAGE['MESSAGE_2']) + filereader.write(UNHANDLED_MESSAGE['MESSAGE_3']) + filereader.write(UNHANDLED_MESSAGE['MESSAGE_4']) + filereader.write(UNHANDLED_MESSAGE['MESSAGE_5']) + filereader.write(UNHANDLED_MESSAGE['MESSAGE_6']) + filereader.write(UNHANDLED_MESSAGE['MESSAGE_7']) utils.waitForGUI(5) @@ -141,6 +151,21 @@ NB: it is a single time callable method should use only after calling "append_unhandled_configuration_file()" method. """ count = 0 + for value in UNHANDLED_MESSAGE['MESSAGE_7']: + if value == '\n': + count+=1 + for value in UNHANDLED_MESSAGE['MESSAGE_6']: + if value == '\n': + count+=1 + for value in UNHANDLED_MESSAGE['MESSAGE_5']: + if value == '\n': + count+=1 + for value in UNHANDLED_MESSAGE['MESSAGE_4']: + if value == '\n': + count+=1 + for value in UNHANDLED_MESSAGE['MESSAGE_3']: + if value == '\n': + count+=1 for value in UNHANDLED_MESSAGE['MESSAGE_2']: if value == '\n': count+=1 @@ -247,7 +272,25 @@ test.verify(message_id.lower() in log_data, "message id should be "+str(unhandled_message[messageID_index])) test.verify([DUMMY_FLOAT_VALUE_1, DUMMY_UNSIGNED_INT_VALUE] in log_data, "API arguments should be "+str([DUMMY_FLOAT_VALUE_1, DUMMY_UNSIGNED_INT_VALUE, 0])) test.verify(config.ACK_REQ_STATUS in log_data, "ack request is verified") - test.verify(config.ACK_BAK_STATUS in log_data, "ack back is verified") + test.verify(config.ACK_BAK_STATUS in log_data, "ack back is verified") + + + #checking everything is passed correctly. (log) + #0xCC00 + payload = integer_to_bytearray(DUMMY_INT_VALUE_1) + payload += unsigned_integer_to_bytearray(DUMMY_UNSIGNED_INT_VALUE) + hd_simulator.cmd_send_hd_general_response(message_id = 204, accepted = 1, reason = 0, is_pure_data = False, has_parameters = True, parameters_payload = payload) + + unhandled_message =UNHANDLED_MESSAGE['MESSAGE_3'].split('\n') + #unhandled_message[2] is the expected message in unhandled.conf after API call + #unhandled_message[messageID_index] is the expected message id in unhandled.conf after API call + + log_data = verify_log(unhandled_message[message_index]) + message_id = convert_message_id_from_unhandled_file_format_to_standared_format(unhandled_message[messageID_index]) + test.verify(message_id.lower() in log_data, "message id should be "+str(unhandled_message[messageID_index])) + test.verify([DUMMY_INT_VALUE_1, DUMMY_UNSIGNED_INT_VALUE] in log_data, "API arguments should be "+str([DUMMY_INT_VALUE_1, DUMMY_UNSIGNED_INT_VALUE, 0])) + test.verify(config.ACK_REQ_STATUS in log_data, "ack request is verified") + test.verify(config.ACK_BAK_STATUS in log_data, "ack back is verified") test.endSection() remove_unhandled_configuration_file()