Ejemplo n.º 1
0
 def test_valid_form(self):
     "Submit valid data"
     
     comment_fourth_lv = Comment.objects.get(pk=3)
     
     # Submit valid data without parent
     user = User.objects.get(pk=1)
     paste = Paste.objects.get()
     data = { 'content': 'foo', 'author': user, 'paste': paste, 'parent': None }
     form = CommentForm(data)
     self.assertTrue(form.is_valid())
     
     # Submit valid data with parent
     user = User.objects.get(pk=1)
     paste = Paste.objects.get()
     data = { 'content': 'foo', 'author': user, 'paste': paste, 'parent': comment_fourth_lv }
     form = CommentForm(data)
     self.assertTrue(form.is_valid())
Ejemplo n.º 2
0
 def test_invalid_form(self):
     "Submit invalid data"
     
     # Submit empty form
     form = CommentForm()
     self.assertFalse(form.is_valid())