示例#1
0
    def test_mailhide_encryption(self):
        """Test email encryption function."""
        test_strings = [('*****@*****.**', '3m5HgumLI4YSLSY-YP9HQA=='),
                        ('*****@*****.**', '9o38o8PEvGrP6V5HSDg_FA=='),
                        ('*****@*****.**', ('ABBkk5Aj2-PJ_izt9yU8pMzt'
                                              'wm-96eABHLBt8jRXxak='))]

        for string, encstring in test_strings:
            padded_string = pad_string(string, AES_PADDING)
            enced_string = enc_string(padded_string)
            safe_string = base64.urlsafe_b64encode(enced_string)
            eq_(encstring, safe_string)
示例#2
0
    def test_mailhide_encryption(self):
        """Test email encryption function."""
        if (getattr(settings, 'MAILHIDE_PUB_KEY', None) !=
                '01Ni54q--g1yltekhaSmPYHQ=='):
            raise SkipTest('Skipping test due to different MailHide pub key.')

        test_strings = [('*****@*****.**', '3m5HgumLI4YSLSY-YP9HQA=='),
                        ('*****@*****.**', '9o38o8PEvGrP6V5HSDg_FA=='),
                        ('*****@*****.**', ('ABBkk5Aj2-PJ_izt9yU8pMzt'
                                              'wm-96eABHLBt8jRXxak='))]

        for string, encstring in test_strings:
            padded_string = pad_string(string, AES_PADDING)
            enced_string = enc_string(padded_string)
            safe_string = base64.urlsafe_b64encode(enced_string)
            eq_(encstring, safe_string)
示例#3
0
    def test_mailhide_encryption(self):
        """Test email encryption function."""
        if (getattr(settings, 'MAILHIDE_PUB_KEY', None) !=
                '01Ni54q--g1yltekhaSmPYHQ=='):
            raise SkipTest('Skipping test due to different MailHide pub key.')

        test_strings = [('*****@*****.**', '3m5HgumLI4YSLSY-YP9HQA=='),
                        ('*****@*****.**', '9o38o8PEvGrP6V5HSDg_FA=='),
                        ('*****@*****.**', ('ABBkk5Aj2-PJ_izt9yU8pMzt'
                                              'wm-96eABHLBt8jRXxak='))]

        for string, encstring in test_strings:
            padded_string = pad_string(string, AES_PADDING)
            enced_string = enc_string(padded_string)
            safe_string = base64.urlsafe_b64encode(enced_string)
            eq_(encstring, safe_string)
示例#4
0
    def test_mailhide_encryption(self):
        """Test email encryption function."""
        if getattr(settings, "MAILHIDE_PUB_KEY", None) != "01Ni54q--g1yltekhaSmPYHQ==":
            raise SkipTest("Skipping test due to different MailHide pub key.")

        test_strings = [
            ("*****@*****.**", "3m5HgumLI4YSLSY-YP9HQA=="),
            ("*****@*****.**", "9o38o8PEvGrP6V5HSDg_FA=="),
            ("*****@*****.**", ("ABBkk5Aj2-PJ_izt9yU8pMzt" "wm-96eABHLBt8jRXxak=")),
        ]

        for string, encstring in test_strings:
            padded_string = pad_string(string, AES_PADDING)
            enced_string = enc_string(padded_string)
            safe_string = base64.urlsafe_b64encode(enced_string)
            eq_(encstring, safe_string)