def test_pending_order(self): """Pending items should be in 'order' order.""" make_test_content( make_container(self.section, 5), ModerateState.pending(), 'ABC' ) make_test_content( make_container(self.section, 3), ModerateState.published(), 'LMN' ) make_test_content( make_container(self.section, 1), ModerateState.pending(), 'XYZ' ) pending = TestContent.objects.pending(self.section) self.assertListEqual( [ 'XYZ', 'LMN', 'ABC', ], [t.title for t in pending] )
def init_container(section, order): """Create a footer - if there isn't one already.""" result = Container.objects.filter(section=section) if result: return result[0] else: return make_container(section, order)
def test_published_order(self): """Published items should by in 'order' order.""" make_test_content( make_container(self.section, 9), ModerateState.published(), 'ABC' ) make_test_content( make_container(self.section, 8), ModerateState.published(), 'XYZ' ) published = TestContent.objects.published(self.section) self.assertListEqual( ['XYZ', 'ABC'], [t.title for t in published] )