Esempio n. 1
0
    def test_new_encode_a_p_abort(self):
        """ Check encoding using new generic method """
        pdu = A_ABORT_RQ()
        pdu.Decode(a_p_abort)
        s = pdu.encode()

        self.assertEqual(s, a_p_abort)
Esempio n. 2
0
    def test_generic_encode(self):
        """ Check using the new pdu.encode produces the correct output """
        pdu = A_ABORT_RQ()
        pdu.Decode(a_abort)
        s = pdu.Encode()
        t = pdu.encode()

        self.assertEqual(s, t)
    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.from_primitive(primitive)
        data = pdu.encode()

        self.assertEqual(data, b"\x07\x00\x00\x00\x00\x04\x00\x00\x02\x04")
    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.from_primitive(primitive)
        data = pdu.encode()

        self.assertEqual(data, b"\x07\x00\x00\x00\x00\x04\x00\x00\x00\x00")
Esempio n. 5
0
    def test_a_p_abort_encode(self):
        """ Check encoding an a_abort produces the correct output """
        pdu = A_ABORT_RQ()
        pdu.decode(a_p_abort)

        assert pdu.encode() == a_p_abort