From e44dfee94ca64a4ccc746682662d1027011d2983 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Tue, 8 Apr 2014 12:48:42 +0100 Subject: [PATCH] PageQuerySet live/type tests now check that the methods return certian objects --- wagtail/wagtailcore/tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wagtail/wagtailcore/tests.py b/wagtail/wagtailcore/tests.py index fb0839266..b352dbc8f 100644 --- a/wagtail/wagtailcore/tests.py +++ b/wagtail/wagtailcore/tests.py @@ -347,6 +347,10 @@ class TestPageQuerySet(TestCase): for page in pages: self.assertTrue(page.live) + # 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_not_live(self): pages = Page.objects.not_live() @@ -354,6 +358,10 @@ class TestPageQuerySet(TestCase): for page in pages: self.assertFalse(page.live) + # Check that "someone elses event" is in the results + event = Page.objects.get(url_path='/home/events/someone-elses-event/') + self.assertTrue(pages.filter(id=event.id).exists()) + def test_page(self): homepage = Page.objects.get(url_path='/home/') pages = Page.objects.page(homepage) @@ -560,9 +568,17 @@ class TestPageQuerySet(TestCase): for page in pages: self.assertIsInstance(page.specific, EventPage) + # Check that "someone elses event" is in the results + event = Page.objects.get(url_path='/home/events/someone-elses-event/') + self.assertTrue(pages.filter(id=event.id).exists()) + def test_not_type(self): pages = Page.objects.not_type(EventPage) # Check that no objects are EventPages for page in pages: self.assertNotIsInstance(page.specific, EventPage) + + # Check that the homepage is in the results + homepage = Page.objects.get(url_path='/home/') + self.assertTrue(pages.filter(id=homepage.id).exists())