Skip to content

Commit a3d435c

Browse files
committedJul 11, 2015
Fixed tests.
1 parent 6173414 commit a3d435c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed
 

Diff for: ‎tests/test_command_import_wordpress.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ def test_create_import_work_without_argument(self):
172172
def test_populate_context(self):
173173
channel = self.import_command.get_channel_from_file(
174174
self.import_filename)
175+
self.import_command.transform_to_html = False
176+
self.import_command.use_wordpress_compiler = False
175177
context = self.import_command.populate_context(channel)
176178

177179
for required_key in ('POSTS', 'PAGES', 'COMPILERS'):
@@ -188,14 +190,16 @@ def test_populate_context(self):
188190
def test_importing_posts_and_attachments(self):
189191
channel = self.import_command.get_channel_from_file(
190192
self.import_filename)
191-
self.import_command.context = self.import_command.populate_context(
192-
channel)
193193
self.import_command.base_dir = ''
194194
self.import_command.output_folder = 'new_site'
195195
self.import_command.squash_newlines = True
196196
self.import_command.no_downloads = False
197197
self.import_command.export_categories_as_categories = False
198198
self.import_command.export_comments = False
199+
self.import_command.transform_to_html = False
200+
self.import_command.use_wordpress_compiler = False
201+
self.import_command.context = self.import_command.populate_context(
202+
channel)
199203

200204
# Ensuring clean results
201205
self.import_command.url_map = {}
@@ -242,7 +246,7 @@ def test_importing_posts_and_attachments(self):
242246
243247
The end.
244248
245-
""")
249+
""", True)
246250

247251
self.assertTrue(write_attachments_info.called)
248252
write_attachments_info.assert_any_call('new_site/posts/2008/07/arzt-und-pfusch-s-i-c-k.attachments.json'.replace('/', os.sep),
@@ -253,7 +257,7 @@ def test_importing_posts_and_attachments(self):
253257
'new_site/posts/2008/07/arzt-und-pfusch-s-i-c-k.md'.replace('/', os.sep),
254258
'''<img class="size-full wp-image-10 alignright" title="Arzt+Pfusch - S.I.C.K." src="http://some.blog/wp-content/uploads/2008/07/arzt_und_pfusch-sick-cover.png" alt="Arzt+Pfusch - S.I.C.K." width="210" height="209" />Arzt+Pfusch - S.I.C.K.Gerade bin ich \xfcber das Album <em>S.I.C.K</em> von <a title="Arzt+Pfusch" href="http://www.arztpfusch.com/" target="_blank">Arzt+Pfusch</a> gestolpert, welches Arzt+Pfusch zum Download f\xfcr lau anbieten. Das Album steht unter einer Creative Commons <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/de/">BY-NC-ND</a>-Lizenz.
255259
256-
Die Ladung <em>noisebmstupidevildustrial</em> gibts als MP3s mit <a href="http://www.archive.org/download/dmp005/dmp005_64kb_mp3.zip">64kbps</a> und <a href="http://www.archive.org/download/dmp005/dmp005_vbr_mp3.zip">VBR</a>, als Ogg Vorbis und als FLAC (letztere <a href="http://www.archive.org/details/dmp005">hier</a>). <a href="http://www.archive.org/download/dmp005/dmp005-artwork.zip">Artwork</a> und <a href="http://www.archive.org/download/dmp005/dmp005-lyrics.txt">Lyrics</a> gibts nochmal einzeln zum Download.''')
260+
Die Ladung <em>noisebmstupidevildustrial</em> gibts als MP3s mit <a href="http://www.archive.org/download/dmp005/dmp005_64kb_mp3.zip">64kbps</a> und <a href="http://www.archive.org/download/dmp005/dmp005_vbr_mp3.zip">VBR</a>, als Ogg Vorbis und als FLAC (letztere <a href="http://www.archive.org/details/dmp005">hier</a>). <a href="http://www.archive.org/download/dmp005/dmp005-artwork.zip">Artwork</a> und <a href="http://www.archive.org/download/dmp005/dmp005-lyrics.txt">Lyrics</a> gibts nochmal einzeln zum Download.''', True)
257261
write_content.assert_any_call(
258262
'new_site/stories/kontakt.md'.replace('/', os.sep), """<h1>Datenschutz</h1>
259263
@@ -273,7 +277,7 @@ def test_importing_posts_and_attachments(self):
273277
274278
</ul>
275279
276-
Diese Daten sind f\xfcr mich nicht bestimmten Personen zuordenbar. Eine Zusammenf\xfchrung dieser Daten mit anderen Datenquellen wird nicht vorgenommen, die Daten werden einzig zu statistischen Zwecken erhoben.""")
280+
Diese Daten sind f\xfcr mich nicht bestimmten Personen zuordenbar. Eine Zusammenf\xfchrung dieser Daten mit anderen Datenquellen wird nicht vorgenommen, die Daten werden einzig zu statistischen Zwecken erhoben.""", True)
277281

278282
self.assertTrue(len(self.import_command.url_map) > 0)
279283

@@ -315,6 +319,9 @@ def test_transforming_content(self):
315319
transform_caption = mock.MagicMock()
316320
transform_newlines = mock.MagicMock()
317321

322+
self.import_command.transform_to_html = False
323+
self.import_command.use_wordpress_compiler = False
324+
318325
with mock.patch('nikola.plugins.command.import_wordpress.CommandImportWordpress.transform_code', transform_code):
319326
with mock.patch('nikola.plugins.command.import_wordpress.CommandImportWordpress.transform_caption', transform_caption):
320327
with mock.patch('nikola.plugins.command.import_wordpress.CommandImportWordpress.transform_multiple_newlines', transform_newlines):

0 commit comments

Comments
 (0)