mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add test for the case where we try to read a file with an unhandled extension
This commit is contained in:
parent
675d6c81cd
commit
7a3bc410d0
2 changed files with 23 additions and 0 deletions
12
pelican/tests/content/article_with_metadata.unknownextension
Normal file
12
pelican/tests/content/article_with_metadata.unknownextension
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
This is a super article !
|
||||
#########################
|
||||
|
||||
:tags: foo, bar, foobar
|
||||
:date: 2010-12-02 10:14
|
||||
:category: yeah
|
||||
:author: Alexis Métaireau
|
||||
:summary:
|
||||
Multi-line metadata should be supported
|
||||
as well as **inline markup**.
|
||||
:custom_field: http://notmyidea.org
|
||||
|
|
@ -14,6 +14,17 @@ CONTENT_PATH = os.path.join(CUR_DIR, 'content')
|
|||
def _path(*args):
|
||||
return os.path.join(CONTENT_PATH, *args)
|
||||
|
||||
class ReaderTests(unittest.TestCase):
|
||||
def test_readfile_unknown_extension(self):
|
||||
f = _path('article_with_metadata.unknownextension')
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
readers.read_file(f)
|
||||
ex = cm.exception
|
||||
self.assertEqual('Pelican does not know how to parse ' + f, ex.message)
|
||||
#, setattr, root.c1.c2, 'text', "test")
|
||||
# self.assertTrue(1 == 0)
|
||||
# except TypeError:
|
||||
# self.assertTrue(1 == 1)
|
||||
|
||||
class RstReaderTest(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue