1
0
Fork 0
forked from github/pelican

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)

This commit is contained in:
Mikhail Korobov 2011-05-11 09:42:37 +06:00
commit 6cd425e408
3 changed files with 33 additions and 4 deletions

View file

@ -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)

View file

@ -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 !

View file

@ -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"