def test_empty_uid_n_create(self): """Test converting N_CREATE_RQ with empty UID value.""" msg = N_CREATE_RQ() for data in [n_create_rq_cmd_empty]: p_data = P_DATA() p_data.presentation_data_value_list.append([0, data]) msg.decode_msg(p_data) primitive = msg.message_to_primitive() assert isinstance(primitive, N_CREATE) assert primitive.AffectedSOPClassUID == UID("1.2.3.4") assert primitive.MessageID == 7 assert primitive.AffectedSOPInstanceUID is None
def test_message_to_primitive_n_create(self): """Test converting N_CREATE_RQ and _RSP to primitive.""" # N-CREATE-RQ msg = N_CREATE_RQ() for data in [n_create_rq_cmd, n_create_rq_ds]: p_data = P_DATA() p_data.presentation_data_value_list.append([0, data]) msg.decode_msg(p_data) primitive = msg.message_to_primitive() assert isinstance(primitive, N_CREATE) assert primitive.AffectedSOPClassUID == UID( "1.2.840.10008.5.1.4.1.1.2") assert primitive.AffectedSOPInstanceUID == UID( "1.2.392.200036.9116.2.6.1.48") assert primitive.MessageID == 7 ds = decode(primitive.AttributeList, True, True) assert ds.PatientName == "Tube HeNe" assert ds.PatientID == "Test1101" # N-ACTION-RSP msg = N_CREATE_RSP() for data in [n_create_rsp_cmd, n_create_rsp_ds]: p_data = P_DATA() p_data.presentation_data_value_list.append([0, data]) msg.decode_msg(p_data) primitive = msg.message_to_primitive() assert isinstance(primitive, N_CREATE) assert primitive.AffectedSOPClassUID == UID("1.2.4.10") assert primitive.AffectedSOPInstanceUID == UID("1.2.4.5.7.8") assert primitive.MessageIDBeingRespondedTo == 5 assert primitive.Status == 0x0000 ds = decode(primitive.AttributeList, True, True) assert ds.PatientName == "Tube HeNe" assert ds.PatientID == "Test1101"