aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_command_import_wordpress.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_command_import_wordpress.py')
-rw-r--r--tests/test_command_import_wordpress.py30
1 files changed, 13 insertions, 17 deletions
diff --git a/tests/test_command_import_wordpress.py b/tests/test_command_import_wordpress.py
index d424162..c05188f 100644
--- a/tests/test_command_import_wordpress.py
+++ b/tests/test_command_import_wordpress.py
@@ -15,6 +15,7 @@ class BasicCommandImportWordpress(BaseTestCase):
def setUp(self):
self.module = nikola.plugins.command.import_wordpress
self.import_command = self.module.CommandImportWordpress()
+ self.import_command.onefile = False
self.import_filename = os.path.abspath(os.path.join(
os.path.dirname(__file__), 'wordpress_export_example.xml'))
@@ -170,6 +171,8 @@ class CommandImportWordpressTest(BasicCommandImportWordpress):
def test_populate_context(self):
channel = self.import_command.get_channel_from_file(
self.import_filename)
+ self.import_command.html2text = False
+ self.import_command.transform_to_markdown = False
self.import_command.transform_to_html = False
self.import_command.use_wordpress_compiler = False
context = self.import_command.populate_context(channel)
@@ -194,6 +197,8 @@ class CommandImportWordpressTest(BasicCommandImportWordpress):
self.import_command.no_downloads = False
self.import_command.export_categories_as_categories = False
self.import_command.export_comments = False
+ self.import_command.html2text = False
+ self.import_command.transform_to_markdown = False
self.import_command.transform_to_html = False
self.import_command.use_wordpress_compiler = False
self.import_command.tag_saniziting_strategy = 'first'
@@ -206,6 +211,7 @@ class CommandImportWordpressTest(BasicCommandImportWordpress):
write_metadata = mock.MagicMock()
write_content = mock.MagicMock()
+ write_post = mock.MagicMock()
write_attachments_info = mock.MagicMock()
download_mock = mock.MagicMock()
@@ -224,7 +230,7 @@ class CommandImportWordpressTest(BasicCommandImportWordpress):
self.assertTrue(write_metadata.called)
write_metadata.assert_any_call(
- 'new_site/stories/kontakt.meta'.replace('/', os.sep), 'Kontakt',
+ 'new_site/pages/kontakt.meta'.replace('/', os.sep), 'Kontakt',
'kontakt', '2009-07-16 20:20:32', '', [], **{'wp-status': 'publish'})
self.assertTrue(write_content.called)
@@ -238,51 +244,39 @@ Some source code.
```Python
import sys
-
print sys.version
```
The end.
-
""", True)
self.assertTrue(write_attachments_info.called)
write_attachments_info.assert_any_call('new_site/posts/2008/07/arzt-und-pfusch-s-i-c-k.attachments.json'.replace('/', os.sep),
{10: {'wordpress_user_name': 'Niko',
'files_meta': [{'width': 300, 'height': 299},
- {'width': b'150', 'size': 'thumbnail', 'height': b'150'}],
+ {'width': 150, 'size': 'thumbnail', 'height': 150}],
'excerpt': 'Arzt+Pfusch - S.I.C.K.',
'date_utc': '2009-07-16 19:40:37',
'content': 'Das Cover von Arzt+Pfusch - S.I.C.K.',
'files': ['/wp-content/uploads/2008/07/arzt_und_pfusch-sick-cover.png',
'/wp-content/uploads/2008/07/arzt_und_pfusch-sick-cover-150x150.png'],
- 'title': 'Arzt+Pfusch - S.I.C.K.'}})
+ 'title': 'Arzt+Pfusch - S.I.C.K.'}})
write_content.assert_any_call(
'new_site/posts/2008/07/arzt-und-pfusch-s-i-c-k.md'.replace('/', os.sep),
'''<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.
-
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)
write_content.assert_any_call(
- 'new_site/stories/kontakt.md'.replace('/', os.sep), """<h1>Datenschutz</h1>
-
+ 'new_site/pages/kontakt.md'.replace('/', os.sep), """<h1>Datenschutz</h1>
Ich erhebe und speichere automatisch in meine Server Log Files Informationen, die dein Browser an mich \xfcbermittelt. Dies sind:
-
<ul>
-
<li>Browsertyp und -version</li>
-
<li>verwendetes Betriebssystem</li>
-
<li>Referrer URL (die zuvor besuchte Seite)</li>
-
<li>IP Adresse des zugreifenden Rechners</li>
-
<li>Uhrzeit der Serveranfrage.</li>
-
</ul>
-
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)
self.assertTrue(len(self.import_command.url_map) > 0)
@@ -296,7 +290,7 @@ Diese Daten sind f\xfcr mich nicht bestimmten Personen zuordenbar. Eine Zusammen
'http://some.blog/posts/2008/07/arzt-und-pfusch-s-i-c-k.html')
self.assertEqual(
self.import_command.url_map['http://some.blog/kontakt/'],
- 'http://some.blog/stories/kontakt.html')
+ 'http://some.blog/pages/kontakt.html')
image_thumbnails = [
'http://some.blog/wp-content/uploads/2012/12/2012-12-19-1355925145_1024x600_scrot-64x64.png',
@@ -325,6 +319,8 @@ Diese Daten sind f\xfcr mich nicht bestimmten Personen zuordenbar. Eine Zusammen
transform_caption = mock.MagicMock()
transform_newlines = mock.MagicMock()
+ self.import_command.html2text = False
+ self.import_command.transform_to_markdown = False
self.import_command.transform_to_html = False
self.import_command.use_wordpress_compiler = False