def test_comment_create(self): res = self.c.post('/post/{0}/comment'.format(self.post_id), {'name': 'John Lennon', 'url': 'http://url.tld', 'email': '*****@*****.**', 'body': 'New Comment'}) # Comment created self.assertEqual(len(Post.get_all_comments(self.post_id)), 1)
def get_context_data(self, id, **kwargs): context = super(PostView, self).get_context_data(**kwargs) context['post'] = Post.get(id) context['comments'] = Post.get_all_comments(id) return context