mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Don't convert posts to lists for wp importer.
This commit is contained in:
parent
ded234467d
commit
942e462241
1 changed files with 8 additions and 6 deletions
|
|
@ -91,8 +91,8 @@ class TestWordpressXmlImporter(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.old_locale = locale.setlocale(locale.LC_ALL)
|
self.old_locale = locale.setlocale(locale.LC_ALL)
|
||||||
locale.setlocale(locale.LC_ALL, str('C'))
|
locale.setlocale(locale.LC_ALL, str('C'))
|
||||||
self.posts = list(wp2fields(WORDPRESS_XML_SAMPLE))
|
self.posts = wp2fields(WORDPRESS_XML_SAMPLE)
|
||||||
self.custposts = list(wp2fields(WORDPRESS_XML_SAMPLE, True))
|
self.custposts = wp2fields(WORDPRESS_XML_SAMPLE, True)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
locale.setlocale(locale.LC_ALL, self.old_locale)
|
locale.setlocale(locale.LC_ALL, self.old_locale)
|
||||||
|
|
@ -242,6 +242,8 @@ class TestWordpressXmlImporter(unittest.TestCase):
|
||||||
self.assertFalse(out_name.endswith(filename))
|
self.assertFalse(out_name.endswith(filename))
|
||||||
|
|
||||||
def test_can_toggle_raw_html_code_parsing(self):
|
def test_can_toggle_raw_html_code_parsing(self):
|
||||||
|
test_posts = list(self.posts)
|
||||||
|
|
||||||
def r(f):
|
def r(f):
|
||||||
with open(f, encoding='utf-8') as infile:
|
with open(f, encoding='utf-8') as infile:
|
||||||
return infile.read()
|
return infile.read()
|
||||||
|
|
@ -250,16 +252,16 @@ class TestWordpressXmlImporter(unittest.TestCase):
|
||||||
with temporary_folder() as temp:
|
with temporary_folder() as temp:
|
||||||
|
|
||||||
rst_files = (r(f) for f
|
rst_files = (r(f) for f
|
||||||
in silent_f2p(self.posts, 'markdown', temp))
|
in silent_f2p(test_posts, 'markdown', temp))
|
||||||
self.assertTrue(any('<iframe' in rst for rst in rst_files))
|
self.assertTrue(any('<iframe' in rst for rst in rst_files))
|
||||||
rst_files = (r(f) for f
|
rst_files = (r(f) for f
|
||||||
in silent_f2p(self.posts, 'markdown',
|
in silent_f2p(test_posts, 'markdown',
|
||||||
temp, strip_raw=True))
|
temp, strip_raw=True))
|
||||||
self.assertFalse(any('<iframe' in rst for rst in rst_files))
|
self.assertFalse(any('<iframe' in rst for rst in rst_files))
|
||||||
# no effect in rst
|
# no effect in rst
|
||||||
rst_files = (r(f) for f in silent_f2p(self.posts, 'rst', temp))
|
rst_files = (r(f) for f in silent_f2p(test_posts, 'rst', temp))
|
||||||
self.assertFalse(any('<iframe' in rst for rst in rst_files))
|
self.assertFalse(any('<iframe' in rst for rst in rst_files))
|
||||||
rst_files = (r(f) for f in silent_f2p(self.posts, 'rst', temp,
|
rst_files = (r(f) for f in silent_f2p(test_posts, 'rst', temp,
|
||||||
strip_raw=True))
|
strip_raw=True))
|
||||||
self.assertFalse(any('<iframe' in rst for rst in rst_files))
|
self.assertFalse(any('<iframe' in rst for rst in rst_files))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue