mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Make the blogger tests consistant with the wp ones - cast
to list in test if needed.
This commit is contained in:
parent
942e462241
commit
a597a31dad
2 changed files with 18 additions and 12 deletions
|
|
@ -44,7 +44,7 @@ class TestBloggerXmlImporter(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.old_locale = locale.setlocale(locale.LC_ALL)
|
||||
locale.setlocale(locale.LC_ALL, str('C'))
|
||||
self.posts = list(blogger2fields(BLOGGER_XML_SAMPLE))
|
||||
self.posts = blogger2fields(BLOGGER_XML_SAMPLE)
|
||||
|
||||
def tearDown(self):
|
||||
locale.setlocale(locale.LC_ALL, self.old_locale)
|
||||
|
|
@ -53,14 +53,15 @@ class TestBloggerXmlImporter(unittest.TestCase):
|
|||
"""Check that importer only outputs pages, articles and comments,
|
||||
that these are correctly identified and that titles are correct.
|
||||
"""
|
||||
kinds = {x[8] for x in self.posts}
|
||||
test_posts = list(self.posts)
|
||||
kinds = {x[8] for x in test_posts}
|
||||
self.assertEqual({'page', 'article', 'comment'}, kinds)
|
||||
page_titles = {x[0] for x in self.posts if x[8] == 'page'}
|
||||
page_titles = {x[0] for x in test_posts if x[8] == 'page'}
|
||||
self.assertEqual({'Test page', 'Test page 2'}, page_titles)
|
||||
article_titles = {x[0] for x in self.posts if x[8] == 'article'}
|
||||
article_titles = {x[0] for x in test_posts if x[8] == 'article'}
|
||||
self.assertEqual({'Black as Egypt\'s Night', 'The Steel Windpipe'},
|
||||
article_titles)
|
||||
comment_titles = {x[0] for x in self.posts if x[8] == 'comment'}
|
||||
comment_titles = {x[0] for x in test_posts if x[8] == 'comment'}
|
||||
self.assertEqual({'Mishka, always a pleasure to read your '
|
||||
'adventures!...'},
|
||||
comment_titles)
|
||||
|
|
@ -69,15 +70,16 @@ class TestBloggerXmlImporter(unittest.TestCase):
|
|||
"""Check that importerer outputs only statuses 'published' and 'draft',
|
||||
that these are correctly identified and that filenames are correct.
|
||||
"""
|
||||
statuses = {x[7] for x in self.posts}
|
||||
test_posts = list(self.posts)
|
||||
statuses = {x[7] for x in test_posts}
|
||||
self.assertEqual({'published', 'draft'}, statuses)
|
||||
|
||||
draft_filenames = {x[2] for x in self.posts if x[7] == 'draft'}
|
||||
draft_filenames = {x[2] for x in test_posts if x[7] == 'draft'}
|
||||
# draft filenames are id-based
|
||||
self.assertEqual({'page-4386962582497458967',
|
||||
'post-1276418104709695660'}, draft_filenames)
|
||||
|
||||
published_filenames = {x[2] for x in self.posts if x[7] == 'published'}
|
||||
published_filenames = {x[2] for x in test_posts if x[7] == 'published'}
|
||||
# published filenames are url-based, except comments
|
||||
self.assertEqual({'the-steel-windpipe',
|
||||
'test-page',
|
||||
|
|
@ -243,7 +245,7 @@ class TestWordpressXmlImporter(unittest.TestCase):
|
|||
|
||||
def test_can_toggle_raw_html_code_parsing(self):
|
||||
test_posts = list(self.posts)
|
||||
|
||||
|
||||
def r(f):
|
||||
with open(f, encoding='utf-8') as infile:
|
||||
return infile.read()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue