From f66c16bd52ff3e9fe0a9c0833e22f53ede89b531 Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Tue, 11 Dec 2012 00:37:06 -0500 Subject: [PATCH] Updated unit tests to test markdown summary metadata. --- ...cle_with_markdown_and_summary_metadata_multi.md | 7 +++++++ ...le_with_markdown_and_summary_metadata_single.md | 5 +++++ tests/test_generators.py | 2 ++ tests/test_readers.py | 14 ++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 tests/content/article_with_markdown_and_summary_metadata_multi.md create mode 100644 tests/content/article_with_markdown_and_summary_metadata_single.md diff --git a/tests/content/article_with_markdown_and_summary_metadata_multi.md b/tests/content/article_with_markdown_and_summary_metadata_multi.md new file mode 100644 index 00000000..b6ef666c --- /dev/null +++ b/tests/content/article_with_markdown_and_summary_metadata_multi.md @@ -0,0 +1,7 @@ +Title: Article with markdown and summary metadata multi +Date: 2012-10-31 +Summary: + A multi-line summary should be supported + as well as **inline markup**. + +This is some content. diff --git a/tests/content/article_with_markdown_and_summary_metadata_single.md b/tests/content/article_with_markdown_and_summary_metadata_single.md new file mode 100644 index 00000000..a7d6f09b --- /dev/null +++ b/tests/content/article_with_markdown_and_summary_metadata_single.md @@ -0,0 +1,5 @@ +Title: Article with markdown and summary metadata single +Date: 2012-10-30 +Summary: A single-line summary should be supported as well as **inline markup**. + +This is some content. diff --git a/tests/test_generators.py b/tests/test_generators.py index 90b19227..fb1dbe9c 100644 --- a/tests/test_generators.py +++ b/tests/test_generators.py @@ -71,6 +71,8 @@ class TestArticlesGenerator(unittest.TestCase): articles = self.distill_articles(generator.articles) articles_expected = [ [u'Article title', 'published', 'Default', 'article'], + [u'Article with markdown and summary metadata single', 'published', u'Default', 'article'], + [u'Article with markdown and summary metadata multi', 'published', u'Default', 'article'], [u'Article with template', 'published', 'Default', 'custom'], [u'Test md File', 'published', 'test', 'article'], [u'Rst with filename metadata', 'published', u'yeah', 'article'], diff --git a/tests/test_readers.py b/tests/test_readers.py index 937a98e3..ae325d62 100644 --- a/tests/test_readers.py +++ b/tests/test_readers.py @@ -203,6 +203,20 @@ class MdReaderTest(unittest.TestCase): for key, value in expected.items(): self.assertEquals(value, metadata[key], key) + @unittest.skipUnless(readers.Markdown, "markdown isn't installed") + def test_article_with_summary_metadata(self): + reader = readers.MarkdownReader({}) + content, metadata = reader.read( + _filename('article_with_markdown_and_summary_metadata_single.md')) + expected_summary = u'

A single-line summary should be supported'\ + u' as well as inline markup.

' + self.assertEquals(expected_summary, metadata['summary'], 'summary') + content, metadata = reader.read( + _filename('article_with_markdown_and_summary_metadata_multi.md')) + expected_summary = u'

A multi-line summary should be supported'\ + u'\nas well as inline markup.

' + self.assertEquals(expected_summary, metadata['summary'], 'summary') + class AdReaderTest(unittest.TestCase): @unittest.skipUnless(readers.asciidoc, "asciidoc isn't installed")