Example #1
0
    def test_encrypted(self):
        encrypted = appier.encrypted(key=b"hello key")
        result = encrypted("hello world")

        self.assertEqual(str(result), "hello world")
        self.assertEqual(result.value, "hello world")
        self.assertEqual(result.encrypted, "vGgMtFgyMVwH3uE=:encrypted")

        result = encrypted("vGgMtFgyMVwH3uE=:encrypted")

        self.assertEqual(str(result), "hello world")
        self.assertEqual(result.value, "hello world")
        self.assertEqual(result.encrypted, "vGgMtFgyMVwH3uE=:encrypted")

        encrypted = appier.encrypted(key=None)
        result = encrypted("hello world")

        self.assertEqual(str(result), "hello world")
        self.assertEqual(result.value, "hello world")
        self.assertEqual(result.value, "hello world")

        result = encrypted("vGgMtFgyMVwH3uE=:encrypted")

        self.assertEqual(str(result), "vGgMtFgyMVwH3uE=:encrypted")
        self.assertEqual(result.value, "vGgMtFgyMVwH3uE=:encrypted")
        self.assertEqual(result.encrypted, "vGgMtFgyMVwH3uE=:encrypted")
Example #2
0
    def test_encrypted(self):
        encrypted = appier.encrypted(key = b"hello key")
        result = encrypted("hello world")

        self.assertEqual(str(result), "hello world")
        self.assertEqual(result.value, "hello world")
        self.assertEqual(result.encrypted, "vGgMtFgyMVwH3uE=:encrypted")

        result = encrypted("vGgMtFgyMVwH3uE=:encrypted")

        self.assertEqual(str(result), "hello world")
        self.assertEqual(result.value, "hello world")
        self.assertEqual(result.encrypted, "vGgMtFgyMVwH3uE=:encrypted")

        encrypted = appier.encrypted(key = None)
        result = encrypted("hello world")

        self.assertEqual(str(result), "hello world")
        self.assertEqual(result.value, "hello world")
        self.assertEqual(result.value, "hello world")

        result = encrypted("vGgMtFgyMVwH3uE=:encrypted")

        self.assertEqual(str(result), "vGgMtFgyMVwH3uE=:encrypted")
        self.assertEqual(result.value, "vGgMtFgyMVwH3uE=:encrypted")
        self.assertEqual(result.encrypted, "vGgMtFgyMVwH3uE=:encrypted")