Ticket #11716: failure_case.patch
File failure_case.patch, 2.4 KB (added by , 15 years ago) |
---|
-
tests/regressiontests/comment_tests/fixtures/comment_tests.json
1 1 [ 2 2 { 3 "model" : "comment_tests.book", 4 "pk" : 1, 5 "fields" : { 6 "dewey_decimal" : "12.34" 7 } 8 }, 9 { 3 10 "model" : "comment_tests.author", 4 11 "pk" : 1, 5 12 "fields" : { -
tests/regressiontests/comment_tests/models.py
28 28 29 29 def __str__(self): 30 30 return self.title 31 32 class Book(models.Model): 33 dewey_decimal = models.DecimalField(primary_key = True, decimal_places=2, max_digits=5) 34 35 No newline at end of file -
tests/regressiontests/comment_tests/tests/comment_view_tests.py
3 3 from django.contrib.auth.models import User 4 4 from django.contrib.comments import signals 5 5 from django.contrib.comments.models import Comment 6 from regressiontests.comment_tests.models import Article 6 from regressiontests.comment_tests.models import Article, Book 7 7 from regressiontests.comment_tests.tests import CommentTestCase 8 8 9 9 post_redirect_re = re.compile(r'^http://testserver/posted/\?c=(?P<pk>\d+$)') 10 10 11 11 class CommentViewTests(CommentTestCase): 12 def testBook(self): 13 b = Book.objects.get(pk='12.34') 14 data = self.getValidData(b) 15 data["comment"] = "This is another comment" 16 data["object_pk"] = 'cookies' 17 response = self.client.post("/post/", data) 18 self.assertEqual(response.status_code, 405) 19 self.assertEqual(response["Allow"], "POST") 12 20 13 21 def testPostCommentHTTPMethods(self): 14 22 a = Article.objects.get(pk=1) … … 234 242 broken_location = location + u"\ufffd" 235 243 response = self.client.get(broken_location) 236 244 self.assertEqual(response.status_code, 200) 245