コード例 #1
0
ファイル: tests.py プロジェクト: damilare/tuberlistic
    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)
コード例 #2
0
ファイル: views.py プロジェクト: damilare/tuberlistic
 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