def test_all_published_pages_for_single_page(page): view = AllPublishedPagesView() qs = view.get_queryset() # Check if published page is returned assert qs.filter(id=page.id).exists() # Check if there are no unpublished pages returned page.live = False page.save() assert not qs.filter(live=False).exists() assert not qs.filter(id=page.id).exists()
def test_all_published_pages_for_multiple_pages(page_tree): view = AllPublishedPagesView() qs = view.get_queryset() # Check if all pages in page tree are returned assert qs.count() == 6