def test_order_by_promote_date_homepage(self): article = self.mk_article( self.yourmind, title='article', slug='article') article.featured_in_homepage_start_date = timezone.now() article.save() article2 = self.mk_article( self.yourmind, title='article2', slug='article2') article2.featured_in_homepage_start_date = timezone.now() article2.save() article3 = self.mk_article( self.yourmind, title='article3', slug='article3') article3.featured_in_homepage_start_date = timezone.now() article3.save() demote_articles() promote_articles() homepage_articles = load_descendant_articles_for_section( {}, self.yourmind, featured_in_homepage=True, count=5) self.assertEqual(homepage_articles[0].title, 'article3') article2.featured_in_homepage_start_date = timezone.now() article2.save() demote_articles() promote_articles() homepage_articles = load_descendant_articles_for_section( {}, self.yourmind, featured_in_homepage=True, count=5) self.assertEqual(homepage_articles[0].title, 'article2')
def test_order_by_promote_date_homepage(self): article = self.mk_article(self.yourmind, title='article', slug='article') article.featured_in_homepage_start_date = timezone.now() article.save() article2 = self.mk_article(self.yourmind, title='article2', slug='article2') article2.featured_in_homepage_start_date = timezone.now() article2.save() article3 = self.mk_article(self.yourmind, title='article3', slug='article3') article3.featured_in_homepage_start_date = timezone.now() article3.save() demote_articles() promote_articles() homepage_articles = load_descendant_articles_for_section( {}, self.yourmind, featured_in_homepage=True, count=5) self.assertEqual(homepage_articles[0].title, 'article3') article2.featured_in_homepage_start_date = timezone.now() article2.save() demote_articles() promote_articles() homepage_articles = load_descendant_articles_for_section( {}, self.yourmind, featured_in_homepage=True, count=5) self.assertEqual(homepage_articles[0].title, 'article2')
def test_order_by_promote_date_latest(self): article = self.mk_article(self.yourmind, title='article', slug='article') article.featured_in_latest_start_date = timezone.now() article.save() article2 = self.mk_article(self.yourmind, title='article2', slug='article2') article2.featured_in_latest_start_date = timezone.now() article2.save() article3 = self.mk_article(self.yourmind, title='article3', slug='article3') article3.featured_in_latest_start_date = timezone.now() article3.save() demote_articles() promote_articles() latest_articles = Main.objects.all().first().latest_articles() self.assertEqual(latest_articles[0].title, 'article3') article2.featured_in_latest_start_date = timezone.now() article2.save() demote_articles() promote_articles() latest_articles = Main.objects.all().first().latest_articles() self.assertEqual(latest_articles[0].title, 'article2')
def test_promote_articles_section(self): article = self.mk_article( self.yourmind, title='article', slug='article') article.featured_in_section_start_date = timezone.now() article.save() demote_articles() promote_articles() article = ArticlePage.objects.all().first() self.assertTrue(article.featured_in_section)
def test_promote_articles_section(self): article = self.mk_article(self.yourmind, title='article', slug='article') article.featured_in_section_start_date = timezone.now() article.save() demote_articles() promote_articles() article = ArticlePage.objects.all().first() self.assertTrue(article.featured_in_section)
def test_order_by_promote_date_latest(self): article = self.mk_article( self.yourmind, title='article', slug='article') article.featured_in_latest_start_date = timezone.now() article.save() article2 = self.mk_article( self.yourmind, title='article2', slug='article2') article2.featured_in_latest_start_date = timezone.now() article2.save() article3 = self.mk_article( self.yourmind, title='article3', slug='article3') article3.featured_in_latest_start_date = timezone.now() article3.save() demote_articles() promote_articles() latest_articles = Main.objects.all().first().latest_articles() self.assertEqual(latest_articles[0].title, 'article3') article2.featured_in_latest_start_date = timezone.now() article2.save() demote_articles() promote_articles() latest_articles = Main.objects.all().first().latest_articles() self.assertEqual(latest_articles[0].title, 'article2')