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)