def test_downcast_two_levels(self): """ Test the downcast function two levels """ # Create a subclass x = FooPage.objects.create() # Retrieve the grandparent class page = Page.objects.get(pk=x.pk) y = downcast(page, "richtextpage__foopage") self.assertEqual(type(y), FooPage)
def test_downcast_one_level(self): """ Test the downcast function one level """ # Create a subclass x = FooPage.objects.create() # Retrieve the grandparent class page = Page.objects.get(pk=x.pk) y = downcast(page, "richtextpage") self.assertEqual(type(y), RichTextPage)