summaryrefslogtreecommitdiff
path: root/tests/plugins/encodings/all.py
blob: a856ccb065fb4e4caae251aa82225f368651d13e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

from chrysacase import ChrysalideTestCase
from pychrysalide.plugins import encodings

import base64


class TestEncodingsModule(ChrysalideTestCase):
    """TestCase for encodings plugin."""

    def testBase64Encoding(self):
        """Validate the base64 implementation."""

        text = '0123456789abcdef'

        for i in range(len(text) + 1):

            src = text[:i].encode('ascii')

            encoded = encodings.base64_encode(src)
            ref = base64.b64encode(src)

            self.assertEqual(encoded, ref)