예제 #1
0
    def test_create(self):
        ext = PaddingExtension()
        ext.create(3)

        self.assertIsNotNone(ext)
        self.assertEqual(ext.extType, 21)
        self.assertEqual(ext.paddingData, bytearray(b'\x00\x00\x00'))
    def test_create(self):
        ext = PaddingExtension()
        ext.create(3)

        self.assertIsNotNone(ext)
        self.assertEqual(ext.extType, 21)
        self.assertEqual(ext.paddingData, bytearray(b'\x00\x00\x00'))
    def test_write(self):
        ext = PaddingExtension()
        ext.create(6)

        self.assertEqual(bytearray(
            b'\x00\x15' +           # type of extension
            b'\x00\x06' +           # overall length of extension
            b'\x00\x00' +           # 1st and 2nd null byte
            b'\x00\x00' +           # 3rd and 4th null byte
            b'\x00\x00'             # 5th and 6th null byte
            ), ext.write())
예제 #4
0
    def test_write(self):
        ext = PaddingExtension()
        ext.create(6)

        self.assertEqual(
            bytearray(b'\x00\x15' +  # type of extension
                      b'\x00\x06' +  # overall length of extension
                      b'\x00\x00' +  # 1st and 2nd null byte
                      b'\x00\x00' +  # 3rd and 4th null byte
                      b'\x00\x00'  # 5th and 6th null byte
                      ),
            ext.write())