Exemple #1
0
 def test_raises_validation_error_when_user_not_saved(self):
     user = User(username="******")
     page = ContentPage(title="Page")
     page.id = 5
     page.pk = page.id
     form = CommentForm(page=page,author=user)
     with self.assertRaises(ValidationError):
         form.is_valid()
Exemple #2
0
 def test_saved_user_and_page_make_validation_successfull(self):
     user = User(username="******")
     user.id = 5
     user.pk = user.id
     page = ContentPage(title="Page")
     page.id = 3 
     page.pk = page.id
     form = CommentForm(page=page, author=user)
     self.assertTrue(form.is_valid())