tests.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:django-cryptography 作者: georgemarshall 项目源码 文件源码
def test_sign_unsign(self):
        """sign/unsign should be reversible"""
        signer = signing.BytesSigner('predictable-secret')
        examples = [
            b'q;wjmbk;wkmb',
            b'3098247529087',
            b'3098247:529:087:',
            b'jkw osanteuh ,rcuh nthu aou oauh ,ud du',
            b'\u2019',
        ]
        if six.PY2:
            examples.append(b'a byte string')
        for example in examples:
            signed = signer.sign(example)
            self.assertIsInstance(signed, six.binary_type)
            self.assertNotEqual(force_str(example), signed)
            self.assertEqual(example, signer.unsign(signed))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号