mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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:
parent
cacc6db9a4
commit
6cd425e408
3 changed files with 33 additions and 4 deletions
27
pelican/tests/test_readers.py
Normal file
27
pelican/tests/test_readers.py
Normal 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)
|
||||||
|
|
@ -5,7 +5,9 @@ This is a super article !
|
||||||
:date: 2010-12-02 10:14
|
:date: 2010-12-02 10:14
|
||||||
:category: yeah
|
:category: yeah
|
||||||
:author: Alexis Métaireau
|
: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 !
|
Some content here !
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ GITHUB_URL = 'http://github.com/ametaireau/'
|
||||||
DISQUS_SITENAME = "blog-notmyidea"
|
DISQUS_SITENAME = "blog-notmyidea"
|
||||||
PDF_GENERATOR = False
|
PDF_GENERATOR = False
|
||||||
REVERSE_CATEGORY_ORDER = True
|
REVERSE_CATEGORY_ORDER = True
|
||||||
LOCALE = 'fr_FR.utf8'
|
LOCALE = 'fr_FR.utf-8'
|
||||||
DEFAULT_PAGINATION = 2
|
DEFAULT_PAGINATION = 2
|
||||||
|
|
||||||
FEED_RSS = 'feeds/all.rss.xml'
|
FEED_RSS = 'feeds/all.rss.xml'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue