示例#1
0
    def test_conversion(self):
        """ Check conversion to a PDU produces the correct output """
        primitive = A_ABORT()
        primitive.abort_source = 0

        pdu = A_ABORT_RQ()
        pdu.FromParams(primitive)
        data = pdu.encode()

        self.assertEqual(data, b"\x07\x00\x00\x00\x00\x04\x00\x00\x00\x00")
示例#2
0
    def test_conversion(self):
        """ Check conversion to a PDU produces the correct output """
        primitive = A_P_ABORT()
        primitive.provider_reason = 4

        pdu = A_ABORT_RQ()
        pdu.FromParams(primitive)
        data = pdu.encode()

        self.assertEqual(data, b"\x07\x00\x00\x00\x00\x04\x00\x00\x02\x04")
示例#3
0
    def test_a_p_abort_from_primitive(self):
        """ Check converting PDU to primitive """
        orig_pdu = A_ABORT_RQ()
        orig_pdu.Decode(a_p_abort)

        primitive = orig_pdu.ToParams()

        new_pdu = A_ABORT_RQ()
        new_pdu.FromParams(primitive)

        self.assertEqual(new_pdu, orig_pdu)