예제 #1
0
파일: tests.py 프로젝트: merkidemis/blog
 def test_comments(self):
     post = Post(author = self.user, title = "Sample", body = "This is a test post")
     post.save()
     
     comment = Comment(post = post, name = "Commenter", email = "*****@*****.**", title = "Sample Comment", comment = "This is a sample comment")
     comment.save()
     
     self.assertEqual(Comment.objects.all().count(), 1)
     postId = str(post._get_pk_val())
     
     response = client.get('/blog/' + postId + '/')
     self.assertEqual(response.status_code, 200)
     self.assertTemplateUsed(response, 'post.html')
     
     self.assertEqual(client.get('/cpi/').status_code, 200)