def get(self, request, blog_id): blog = Blog.get_by_id(blog_id) posts = Post.get_all_posts(blog) if not blog: return RESPONSE_404_OBJECT_NOT_FOUND return render(request, 'blog/index.html', { 'blog': blog, 'posts': posts })
def test_get_all_posts(self): posts = Post.get_all_posts(self.blog) self.assertSetEqual(set(posts), {self.post})