diff --git a/wagtail/wagtailcore/tests/test_page_model.py b/wagtail/wagtailcore/tests/test_page_model.py index 1bae57952..dfc45d72a 100644 --- a/wagtail/wagtailcore/tests/test_page_model.py +++ b/wagtail/wagtailcore/tests/test_page_model.py @@ -224,3 +224,25 @@ class TestMovePage(TestCase): christmas = events_index.get_children().get(slug='christmas') self.assertEqual(christmas.depth, 5) self.assertEqual(christmas.url_path, '/home/about-us/events/christmas/') + + +class TestPagePagination(TestCase): + fixtures = ['test.json'] + + def test_published_next(self): + events_index = Page.objects.get(url_path='/home/events/') + current_page = Page.objects.descendant_of(events_index).live().first() + + # All pages must be live + while current_page: + self.assertTrue(current_page.live) + current_page = current_page.get_next_siblings().live().first() + + def test_published_prev(self): + events_index = Page.objects.get(url_path='/home/events/') + current_page = Page.objects.descendant_of(events_index).live().last() + + # All pages must be live + while current_page: + self.assertTrue(current_page.live) + current_page = current_page.get_prev_siblings().live().first() diff --git a/wagtail/wagtailcore/tests/test_page_queryset.py b/wagtail/wagtailcore/tests/test_page_queryset.py index 020d98d15..06f2c3e21 100644 --- a/wagtail/wagtailcore/tests/test_page_queryset.py +++ b/wagtail/wagtailcore/tests/test_page_queryset.py @@ -254,21 +254,3 @@ class TestPageQuerySet(TestCase): # Check that the homepage is in the results homepage = Page.objects.get(url_path='/home/') self.assertTrue(pages.filter(id=homepage.id).exists()) - - def test_published_next(self): - events_index = Page.objects.get(url_path='/home/events/') - current_page = Page.objects.descendant_of(events_index).live().first() - - # All pages must be live - while current_page: - self.assertTrue(current_page.live) - current_page = current_page.get_next_siblings().live().first() - - def test_published_prev(self): - events_index = Page.objects.get(url_path='/home/events/') - current_page = Page.objects.descendant_of(events_index).live().last() - - # All pages must be live - while current_page: - self.assertTrue(current_page.live) - current_page = current_page.get_prev_siblings().live().first()