mirror of
https://github.com/django/django.git
synced 2025-11-20 03:30:00 +00:00
Removed Django 1.2 compatibility fallback for contrib.comments forms hash.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c922a04675
commit
5fa11b0035
2 changed files with 1 additions and 31 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import hashlib
|
||||
import time
|
||||
|
||||
from django.conf import settings
|
||||
|
|
@ -46,23 +45,6 @@ class CommentFormTests(CommentTestCase):
|
|||
def testObjectPKTampering(self):
|
||||
self.tamperWithForm(object_pk="3")
|
||||
|
||||
def testDjango12Hash(self):
|
||||
# Ensure we can use the hashes generated by Django 1.2
|
||||
a = Article.objects.get(pk=1)
|
||||
d = self.getValidData(a)
|
||||
|
||||
content_type = d['content_type']
|
||||
object_pk = d['object_pk']
|
||||
timestamp = d['timestamp']
|
||||
|
||||
# The Django 1.2 method hard-coded here:
|
||||
info = (content_type, object_pk, timestamp, settings.SECRET_KEY)
|
||||
security_hash = hashlib.sha1("".join(info)).hexdigest()
|
||||
|
||||
d['security_hash'] = security_hash
|
||||
f = CommentForm(a, data=d)
|
||||
self.assertTrue(f.is_valid(), f.errors)
|
||||
|
||||
def testSecurityErrors(self):
|
||||
f = self.tamperWithForm(honeypot="I am a robot")
|
||||
self.assertTrue("honeypot" in f.security_errors())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue