mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Cleaned up markdown test cases:
- test_article_with_md_extension - test_article_with_mkd_extension - test_article_with_markdown_extension and replaced with: - test_article_with_metadata - test_article_with_file_extensions
This commit is contained in:
parent
56a276d92e
commit
a441596b07
2 changed files with 32 additions and 26 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
title: Test md File
|
Title: Test md File
|
||||||
category: test
|
Category: test
|
||||||
|
Tags: foo, bar, foobar
|
||||||
|
Date: 2010-12-02 10:14
|
||||||
|
Summary: I have a lot to test
|
||||||
|
|
||||||
Test Markdown File Header
|
Test Markdown File Header
|
||||||
=========================
|
=========================
|
||||||
|
|
|
||||||
|
|
@ -115,43 +115,46 @@ class RstReaderTest(unittest.TestCase):
|
||||||
class MdReaderTest(unittest.TestCase):
|
class MdReaderTest(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
||||||
def test_article_with_md_extension(self):
|
def test_article_with_metadata(self):
|
||||||
# test to ensure the md extension is being processed by the correct reader
|
|
||||||
reader = readers.MarkdownReader({})
|
reader = readers.MarkdownReader({})
|
||||||
content, metadata = reader.read(_path('article_with_md_extension.md'))
|
content, metadata = reader.read(
|
||||||
expected = "<h1>Test Markdown File Header</h1>\n"\
|
_path('article_with_md_extension.md'))
|
||||||
"<h2>Used for pelican test</h2>\n"\
|
|
||||||
"<p>The quick brown fox jumped over the lazy dog's back.</p>"
|
|
||||||
|
|
||||||
self.assertEqual(content, expected)
|
|
||||||
|
|
||||||
expected = {
|
expected = {
|
||||||
'category': 'test',
|
'category': 'test',
|
||||||
'title': 'Test md File',
|
'title': 'Test md File',
|
||||||
|
'summary': '<p>I have a lot to test</p>',
|
||||||
|
'date': datetime.datetime(2010, 12, 2, 10, 14),
|
||||||
|
'tags': ['foo', 'bar', 'foobar'],
|
||||||
}
|
}
|
||||||
for key, value in metadata.items():
|
for key, value in metadata.items():
|
||||||
self.assertEquals(value, expected[key], key)
|
self.assertEquals(value, expected[key], key)
|
||||||
|
|
||||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
||||||
def test_article_with_mkd_extension(self):
|
def test_article_with_file_extensions(self):
|
||||||
# test to ensure the mkd extension is being processed by the correct reader
|
|
||||||
reader = readers.MarkdownReader({})
|
reader = readers.MarkdownReader({})
|
||||||
content, metadata = reader.read(_path('article_with_mkd_extension.mkd'))
|
# test to ensure the md file extension is being processed by the
|
||||||
|
# correct reader
|
||||||
|
content, metadata = reader.read(
|
||||||
|
_path('article_with_md_extension.md'))
|
||||||
expected = "<h1>Test Markdown File Header</h1>\n"\
|
expected = "<h1>Test Markdown File Header</h1>\n"\
|
||||||
"<h2>Used for pelican test</h2>\n"\
|
"<h2>Used for pelican test</h2>\n"\
|
||||||
"<p>This is another markdown test file. Uses the mkd extension.</p>"
|
"<p>The quick brown fox jumped over the lazy dog's back.</p>"
|
||||||
|
|
||||||
self.assertEqual(content, expected)
|
self.assertEqual(content, expected)
|
||||||
|
# test to ensure the mkd file extension is being processed by the
|
||||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
# correct reader
|
||||||
def test_article_with_mkd_extension(self):
|
content, metadata = reader.read(
|
||||||
# test to ensure the markdown extension is being processed by the correct reader
|
_path('article_with_mkd_extension.mkd'))
|
||||||
reader = readers.MarkdownReader({})
|
expected = "<h1>Test Markdown File Header</h1>\n<h2>Used for pelican"\
|
||||||
content, metadata = reader.read(_filename('article_with_markdown_extension.markdown'))
|
" test</h2>\n<p>This is another markdown test file. Uses"\
|
||||||
expected = "<h1>Test Markdown File Header</h1>\n"\
|
" the mkd extension.</p>"
|
||||||
"<h2>Used for pelican test</h2>\n"\
|
self.assertEqual(content, expected)
|
||||||
"<p>This is another markdown test file. Uses the markdown extension.</p>"
|
# test to ensure the markdown file extension is being processed by the
|
||||||
|
# correct reader
|
||||||
|
content, metadata = reader.read(
|
||||||
|
_path('article_with_markdown_extension.markdown'))
|
||||||
|
expected = "<h1>Test Markdown File Header</h1>\n<h2>Used for pelican"\
|
||||||
|
" test</h2>\n<p>This is another markdown test file. Uses"\
|
||||||
|
" the markdown extension.</p>"
|
||||||
self.assertEqual(content, expected)
|
self.assertEqual(content, expected)
|
||||||
|
|
||||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue