mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
get tests passing
This commit is contained in:
parent
9e51e767d4
commit
7b59b34a73
4 changed files with 17 additions and 28 deletions
|
|
@ -1,7 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
Summary comment is not included.
|
||||
<!-- PELICAN_END_SUMMARY -->
|
||||
<!-- But this comment is (including extra whitespace) -->
|
||||
Body content
|
||||
<!-- This comment is included (including extra whitespace) -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
<meta name="date" contents="2010-12-02 10:14" />
|
||||
<meta name="category" contents="yeah" />
|
||||
<meta name="author" contents="Alexis Métaireau" />
|
||||
<meta name="summary" contents="Summary and stuff" />
|
||||
<meta name="custom_field" contents="http://notmyidea.org" />
|
||||
</head>
|
||||
<body>
|
||||
Multi-line metadata should be supported
|
||||
as well as <strong>inline markup</strong>.
|
||||
<!-- PELICAN_END_SUMMARY -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -264,25 +264,16 @@ class AdReaderTest(unittest.TestCase):
|
|||
class HTMLReaderTest(unittest.TestCase):
|
||||
def test_article_with_comments(self):
|
||||
reader = readers.HTMLReader({})
|
||||
content, metadata = reader.read(_filename('article_with_comments.html'))
|
||||
expected = {
|
||||
'summary': '''
|
||||
Summary comment is not included.
|
||||
''',
|
||||
}
|
||||
|
||||
for key, value in expected.items():
|
||||
self.assertEquals(value, metadata[key], key)
|
||||
content, metadata = reader.read(_path('article_with_comments.html'))
|
||||
|
||||
self.assertEquals('''
|
||||
Summary comment is not included.
|
||||
|
||||
<!-- But this comment is (including extra whitespace) -->
|
||||
Body content
|
||||
<!-- This comment is included (including extra whitespace) -->
|
||||
''', content)
|
||||
|
||||
def test_article_with_keywords(self):
|
||||
reader = readers.HTMLReader({})
|
||||
content, metadata = reader.read(_filename('article_with_keywords.html'))
|
||||
content, metadata = reader.read(_path('article_with_keywords.html'))
|
||||
expected = {
|
||||
'tags': ['foo', 'bar', 'foobar'],
|
||||
}
|
||||
|
|
@ -292,15 +283,12 @@ class HTMLReaderTest(unittest.TestCase):
|
|||
|
||||
def test_article_with_metadata(self):
|
||||
reader = readers.HTMLReader({})
|
||||
content, metadata = reader.read(_filename('article_with_metadata.html'))
|
||||
content, metadata = reader.read(_path('article_with_metadata.html'))
|
||||
expected = {
|
||||
'category': 'yeah',
|
||||
'author': u'Alexis Métaireau',
|
||||
'title': 'This is a super article !',
|
||||
'summary': u'''
|
||||
Multi-line metadata should be supported
|
||||
as well as <strong>inline markup</strong>.
|
||||
''',
|
||||
'summary': u'''Summary and stuff''',
|
||||
'date': datetime.datetime(2010, 12, 2, 10, 14),
|
||||
'tags': ['foo', 'bar', 'foobar'],
|
||||
'custom_field': 'http://notmyidea.org',
|
||||
|
|
@ -313,6 +301,6 @@ class HTMLReaderTest(unittest.TestCase):
|
|||
def test_article_metadata_key_lowercase(self):
|
||||
"""Keys of metadata should be lowercase."""
|
||||
reader = readers.HTMLReader({})
|
||||
content, metadata = reader.read(_filename('article_with_uppercase_metadata.html'))
|
||||
content, metadata = reader.read(_path('article_with_uppercase_metadata.html'))
|
||||
self.assertIn('category', metadata, "Key should be lowercase.")
|
||||
self.assertEquals('Yeah', metadata.get('category'), "Value keeps cases.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue