Пример #1
0
    def test_md5_string(self):
        string = "A string"
        Alphabet.objects.create(d=string)
        pymd5 = hashlib.md5(string.encode("ascii")).hexdigest()

        with self.assertWarnsMessage(DeprecationWarning,
                                     "This function is deprecated."):
            md5 = MD5("d")
        ab = Alphabet.objects.annotate(md5=md5).first()

        assert ab.md5 == pymd5
Пример #2
0
 def test_md5_string(self):
     string = 'A string'
     Alphabet.objects.create(d=string)
     pymd5 = hashlib.md5(string.encode('ascii')).hexdigest()
     ab = Alphabet.objects.annotate(md5=MD5('d')).first()
     assert ab.md5 == pymd5