diff options
author | Mikhail Korobov <kmike84@gmail.com> | 2011-05-11 09:42:37 +0600 |
---|---|---|
committer | Mikhail Korobov <kmike84@gmail.com> | 2011-05-11 09:42:37 +0600 |
commit | 6cd425e408bf85cd12ba36c536bc3ff8d78c4fc7 (patch) | |
tree | db620ea840480f4ebbe17a5c1fd0af395e766d01 | |
parent | cacc6db9a4cbbce979e4ebf90c93c770f6359453 (diff) | |
download | pelican-6cd425e408bf85cd12ba36c536bc3ff8d78c4fc7.tar.gz |
Basic test for the new rst reader. Locale is also converted to fr_FR.utf-8 (I wasn't able to run tests without this)
-rw-r--r-- | pelican/tests/test_readers.py | 27 | ||||
-rw-r--r-- | samples/content/super_article.rst | 4 | ||||
-rwxr-xr-x | samples/pelican.conf.py | 6 |
3 files changed, 33 insertions, 4 deletions
diff --git a/pelican/tests/test_readers.py b/pelican/tests/test_readers.py new file mode 100644 index 00000000..5a255209 --- /dev/null +++ b/pelican/tests/test_readers.py @@ -0,0 +1,27 @@ +# coding: utf-8 +import unittest2 +import os +import datetime +from pelican import readers + +CUR_DIR = os.path.dirname(__file__) +CONTENT_PATH = os.path.join(CUR_DIR, '..', '..', 'samples', 'content') + +def _filename(*args): + return os.path.join(CONTENT_PATH, *args) + + +class RstReaderTest(unittest2.TestCase): + + def test_metadata(self): + reader = readers.RstReader() + content, metadata = reader.read(_filename('super_article.rst')) + expected = { + 'category': 'yeah', + 'author': u'Alexis Métaireau', + 'title': 'This is a super article !', + 'summary': 'Multi-line metadata should be supported\nas well as <strong>inline markup</strong>.', + 'date': datetime.datetime(2010, 12, 2, 10, 14), + 'tags': ['foo', 'bar', 'foobar'], + } + self.assertDictEqual(metadata, expected) diff --git a/samples/content/super_article.rst b/samples/content/super_article.rst index b3e22051..03273fad 100644 --- a/samples/content/super_article.rst +++ b/samples/content/super_article.rst @@ -5,7 +5,9 @@ This is a super article ! :date: 2010-12-02 10:14 :category: yeah :author: Alexis Métaireau -:summary: This is a simple test +:summary: + Multi-line metadata should be supported + as well as **inline markup**. Some content here ! diff --git a/samples/pelican.conf.py b/samples/pelican.conf.py index a3a07fad..8648e7cb 100755 --- a/samples/pelican.conf.py +++ b/samples/pelican.conf.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- AUTHOR = u'Alexis Métaireau' -SITENAME = u"Alexis' log" +SITENAME = u"Alexis' log" SITEURL = 'http://blog.notmyidea.org' GITHUB_URL = 'http://github.com/ametaireau/' DISQUS_SITENAME = "blog-notmyidea" PDF_GENERATOR = False REVERSE_CATEGORY_ORDER = True -LOCALE = 'fr_FR.utf8' +LOCALE = 'fr_FR.utf-8' DEFAULT_PAGINATION = 2 FEED_RSS = 'feeds/all.rss.xml' @@ -33,6 +33,6 @@ STATIC_PATHS = ["pictures",] # A list of files to copy from the source to the destination FILES_TO_COPY = (('extra/robots.txt', 'robots.txt'),) -# foobar will not be used, because it's not in caps. All configuration keys +# foobar will not be used, because it's not in caps. All configuration keys # have to be in caps foobar = "barbaz" |