Ejemplo n.º 1
0
    def test_conversion_rsp(self):
        """ Check conversion to a -RQ PDU produces the correct output """
        primitive = C_ECHO()
        primitive.MessageIDBeingRespondedTo = 8
        primitive.AffectedSOPClassUID = '1.2.840.10008.1.1'
        primitive.Status = 0x0000

        dimse_msg = C_ECHO_RSP()
        dimse_msg.primitive_to_message(primitive)

        pdvs = []
        for fragment in dimse_msg.encode_msg(1, 16382):
            pdvs.append(fragment)
        cs_pdv = pdvs[0].presentation_data_value_list[0][1]
        assert cs_pdv == c_echo_rsp_cmd
Ejemplo n.º 2
0
    def test_callback_receive_c_echo(self):
        """Check callback for receiving DIMSE C-ECHO messages."""
        # C-ECHO-RQ
        primitive = C_ECHO()
        primitive.MessageID = 7
        primitive.Priority = 0x02
        msg = C_ECHO_RQ()
        msg.primitive_to_message(primitive)
        msg.context_id = 1
        self.dimse.debug_receive_c_echo_rq(msg)

        # C-ECHO-RSP
        primitive = C_ECHO()
        primitive.MessageIDBeingRespondedTo = 4
        primitive.Status = 0x0000
        msg = C_ECHO_RSP()
        msg.primitive_to_message(primitive)
        self.dimse.debug_receive_c_echo_rsp(msg)
Ejemplo n.º 3
0
    def test_message_to_primitive_c_echo(self):
        """Test converting C_ECHO_RQ to C_ECHO primitive."""
        msg = C_ECHO_RQ()
        p_data = P_DATA()
        p_data.presentation_data_value_list.append([0, c_echo_rq_cmd])
        msg.decode_msg(p_data)
        primitive = msg.message_to_primitive()
        assert isinstance(primitive, C_ECHO)
        assert primitive.AffectedSOPClassUID == UID("1.2.840.10008.1.1")
        assert primitive.MessageID == 7

        msg = C_ECHO_RSP()
        p_data = P_DATA()
        p_data.presentation_data_value_list.append([0, c_echo_rsp_cmd])
        msg.decode_msg(p_data)
        primitive = msg.message_to_primitive()
        assert isinstance(primitive, C_ECHO)
        assert primitive.AffectedSOPClassUID == UID("1.2.840.10008.1.1")
        assert primitive.MessageIDBeingRespondedTo == 8
        assert primitive.Status == 0