forked from github/pelican
commit
a7b18515a1
3 changed files with 43 additions and 16 deletions
10
tests/content/article_with_markdown_extension.markdown
Normal file
10
tests/content/article_with_markdown_extension.markdown
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
title: Test markdown File
|
||||
category: test
|
||||
|
||||
Test Markdown File Header
|
||||
=========================
|
||||
|
||||
Used for pelican test
|
||||
---------------------
|
||||
|
||||
This is another markdown test file. Uses the markdown extension.
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
title: Test md File
|
||||
category: test
|
||||
Title: Test md File
|
||||
Category: test
|
||||
Tags: foo, bar, foobar
|
||||
Date: 2010-12-02 10:14
|
||||
Summary: I have a lot to test
|
||||
|
||||
Test Markdown File Header
|
||||
=========================
|
||||
|
|
|
|||
|
|
@ -115,32 +115,46 @@ class RstReaderTest(unittest.TestCase):
|
|||
class MdReaderTest(unittest.TestCase):
|
||||
|
||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
||||
def test_article_with_md_extension(self):
|
||||
# test to ensure the md extension is being processed by the correct reader
|
||||
def test_article_with_metadata(self):
|
||||
reader = readers.MarkdownReader({})
|
||||
content, metadata = reader.read(_path('article_with_md_extension.md'))
|
||||
expected = "<h1>Test Markdown File Header</h1>\n"\
|
||||
"<h2>Used for pelican test</h2>\n"\
|
||||
"<p>The quick brown fox jumped over the lazy dog's back.</p>"
|
||||
|
||||
self.assertEqual(content, expected)
|
||||
|
||||
content, metadata = reader.read(
|
||||
_path('article_with_md_extension.md'))
|
||||
expected = {
|
||||
'category': 'test',
|
||||
'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():
|
||||
self.assertEquals(value, expected[key], key)
|
||||
|
||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
||||
def test_article_with_mkd_extension(self):
|
||||
# test to ensure the mkd extension is being processed by the correct reader
|
||||
def test_article_with_file_extensions(self):
|
||||
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"\
|
||||
"<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)
|
||||
# test to ensure the mkd file extension is being processed by the
|
||||
# correct reader
|
||||
content, metadata = reader.read(
|
||||
_path('article_with_mkd_extension.mkd'))
|
||||
expected = "<h1>Test Markdown File Header</h1>\n<h2>Used for pelican"\
|
||||
" test</h2>\n<p>This is another markdown test file. Uses"\
|
||||
" the mkd extension.</p>"
|
||||
self.assertEqual(content, expected)
|
||||
# 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)
|
||||
|
||||
@unittest.skipUnless(readers.Markdown, "markdown isn't installed")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue