1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the base32 decoder object."""
import unittest
from dfvfs.encoding import base32_decoder
from dfvfs.lib import errors
from tests.encoding import test_lib
class Base32DecoderTestCase(test_lib.DecoderTestCase):
"""Tests for the base32 decoder object."""
def testDecode(self):
"""Tests the Decode method."""
decoder = base32_decoder.Base32Decoder()
decoded_data, _ = decoder.Decode(b'AEBAGBAFAYDQQ===')
expected_decoded_data = b'\x01\x02\x03\x04\x05\x06\x07\x08'
self.assertEqual(decoded_data, expected_decoded_data)
decoder = base32_decoder.Base32Decoder()
with self.assertRaises(errors.BackEndError):
_, _ = decoder.Decode(b'\x01\x02\x03\x04\x05\x06\x07\x08')
if __name__ == '__main__':
unittest.main()
|