utils.py 文件源码

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

项目:Callandtext 作者: iaora 项目源码 文件源码
def test_80_faulty_crypt(self):
        "test with faulty crypt()"
        hash = self.get_sample_hash()[1]
        exc_types = (AssertionError,)
        setter = self._use_mock_crypt()

        def test(value):
            # set safe_crypt() to return specified value, and
            # make sure assertion error is raised by handler.
            setter(value)
            self.assertRaises(exc_types, self.do_genhash, "stub", hash)
            self.assertRaises(exc_types, self.do_encrypt, "stub")
            self.assertRaises(exc_types, self.do_verify, "stub", hash)

        test('$x' + hash[2:]) # detect wrong prefix
        test(hash[:-1]) # detect too short
        test(hash + 'x') # detect too long
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号