mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Test cases for hidden articles and drafts
This commit is contained in:
parent
904f52bc1a
commit
fac43df2da
3 changed files with 24 additions and 0 deletions
5
pelican/tests/content/article_draft.md
vendored
Normal file
5
pelican/tests/content/article_draft.md
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Title: Draft article
|
||||||
|
Date: 2012-10-31
|
||||||
|
Status: draft
|
||||||
|
|
||||||
|
This is some content.
|
||||||
5
pelican/tests/content/article_hidden.md
vendored
Normal file
5
pelican/tests/content/article_hidden.md
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Title: Hidden article
|
||||||
|
Date: 2012-10-31
|
||||||
|
Status: hidden
|
||||||
|
|
||||||
|
This is some unlisted content.
|
||||||
|
|
@ -181,6 +181,8 @@ class TestArticlesGenerator(unittest.TestCase):
|
||||||
path=CONTENT_DIR, theme=settings['THEME'], output_path=None)
|
path=CONTENT_DIR, theme=settings['THEME'], output_path=None)
|
||||||
cls.generator.generate_context()
|
cls.generator.generate_context()
|
||||||
cls.articles = cls.distill_articles(cls.generator.articles)
|
cls.articles = cls.distill_articles(cls.generator.articles)
|
||||||
|
cls.drafts = cls.distill_articles(cls.generator.drafts)
|
||||||
|
cls.hidden_articles = cls.distill_articles(cls.generator.hidden_articles)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.temp_cache = mkdtemp(prefix='pelican_cache.')
|
self.temp_cache = mkdtemp(prefix='pelican_cache.')
|
||||||
|
|
@ -283,6 +285,18 @@ class TestArticlesGenerator(unittest.TestCase):
|
||||||
]
|
]
|
||||||
self.assertEqual(sorted(articles_expected), sorted(self.articles))
|
self.assertEqual(sorted(articles_expected), sorted(self.articles))
|
||||||
|
|
||||||
|
def test_articles_draft(self):
|
||||||
|
draft_articles_expected = [
|
||||||
|
['Draft article', 'draft', 'Default', 'article'],
|
||||||
|
]
|
||||||
|
self.assertEqual(sorted(draft_articles_expected), sorted(self.drafts))
|
||||||
|
|
||||||
|
def test_articles_hidden(self):
|
||||||
|
hidden_articles_expected = [
|
||||||
|
['Hidden article', 'hidden', 'Default', 'article'],
|
||||||
|
]
|
||||||
|
self.assertEqual(sorted(hidden_articles_expected), sorted(self.hidden_articles))
|
||||||
|
|
||||||
def test_generate_categories(self):
|
def test_generate_categories(self):
|
||||||
# test for name
|
# test for name
|
||||||
# categories are grouped by slug; if two categories have the same slug
|
# categories are grouped by slug; if two categories have the same slug
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue