def test_sha1_string(self): string = "A string" Alphabet.objects.create(d=string) pysha1 = hashlib.sha1(string.encode("ascii")).hexdigest() with self.assertWarnsMessage(DeprecationWarning, "This function is deprecated."): sha1 = SHA1("d") ab = Alphabet.objects.annotate(sha=sha1).first() assert ab.sha == pysha1
def test_sha1_string(self): string = 'A string' Alphabet.objects.create(d=string) pysha1 = hashlib.sha1(string.encode('ascii')).hexdigest() ab = Alphabet.objects.annotate(sha=SHA1('d')).first() assert ab.sha == pysha1