summaryrefslogtreecommitdiffstats
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.py52
1 files changed, 17 insertions, 35 deletions
diff --git a/tests/test_command_import_wordpress.py b/tests/test_command_import_wordpress.py
index fafb10c..2c47bc3 100644
--- a/tests/test_command_import_wordpress.py
+++ b/tests/test_command_import_wordpress.py
@@ -25,29 +25,6 @@ class BasicCommandImportWordpress(BaseTestCase):
del self.import_filename
-class TestXMLGlueing(BasicCommandImportWordpress):
- def test_making_correct_newlines(self):
- xml = [b"Some information about how to (un)subscripe to a google group with a normal mail client.\n",
- b"<ul>\n",
- b" <li>to post: <strong>groupname@googlegroups.com</strong></li>\n",
- b" <li>to <em>subscribe</em>: <strong>groupname+subscribe@googlegroups.com</strong></li>\n",
- b" <li>to <em>unsubscribe</em>: <strong>groupname+unsubscribe@googlegroups.com</strong></li>\n",
- b"</ul>\n",
- b"Easy.\n"]
-
- expected_xml = b"""Some information about how to (un)subscripe to a google group with a normal mail client.
-
-<ul>
- <li>to post: <strong>groupname@googlegroups.com</strong></li>
- <li>to <em>subscribe</em>: <strong>groupname+subscribe@googlegroups.com</strong></li>
- <li>to <em>unsubscribe</em>: <strong>groupname+unsubscribe@googlegroups.com</strong></li>
-</ul>
-
-Easy.
-"""
- self.assertEqual(expected_xml, self.import_command._glue_xml_lines(xml))
-
-
class TestQTranslateContentSeparation(BasicCommandImportWordpress):
def test_conserves_qtranslate_less_post(self):
@@ -241,7 +218,7 @@ class CommandImportWordpressTest(BasicCommandImportWordpress):
self.assertTrue(write_metadata.called)
write_metadata.assert_any_call(
'new_site/stories/kontakt.meta'.replace('/', os.sep), 'Kontakt',
- 'kontakt', '2009-07-16 20:20:32', None, [])
+ 'kontakt', '2009-07-16 20:20:32', '', [])
self.assertTrue(write_content.called)
write_content.assert_any_call('new_site/posts/2007/04/hoert.wp'.replace('/', os.sep),
@@ -251,13 +228,13 @@ class CommandImportWordpressTest(BasicCommandImportWordpress):
Some source code.
-~~~~~~~~~~~~{.Python}
+```Python
import sys
print sys.version
-~~~~~~~~~~~~
+```
The end.
@@ -266,17 +243,25 @@ The end.
write_content.assert_any_call(
'new_site/posts/2008/07/arzt-und-pfusch-s-i-c-k.wp'.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.''')
write_content.assert_any_call(
'new_site/stories/kontakt.wp'.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.""")
@@ -317,16 +302,16 @@ Diese Daten sind f\xfcr mich nicht bestimmten Personen zuordenbar. Eine Zusammen
def test_transforming_content(self):
"""Applying markup conversions to content."""
- transform_sourcecode = mock.MagicMock()
+ transform_code = mock.MagicMock()
transform_caption = mock.MagicMock()
transform_newlines = mock.MagicMock()
- with mock.patch('nikola.plugins.command.import_wordpress.CommandImportWordpress.transform_sourcecode', transform_sourcecode):
+ with mock.patch('nikola.plugins.command.import_wordpress.CommandImportWordpress.transform_code', transform_code):
with mock.patch('nikola.plugins.command.import_wordpress.CommandImportWordpress.transform_caption', transform_caption):
with mock.patch('nikola.plugins.command.import_wordpress.CommandImportWordpress.transform_multiple_newlines', transform_newlines):
self.import_command.transform_content("random content")
- self.assertTrue(transform_sourcecode.called)
+ self.assertTrue(transform_code.called)
self.assertTrue(transform_caption.called)
self.assertTrue(transform_newlines.called)
@@ -340,21 +325,18 @@ import sys
print sys.version
[/sourcecode]"""
- content = self.import_command.transform_sourcecode(content)
+ content = self.import_command.transform_code(content)
self.assertFalse('[/sourcecode]' in content)
self.assertFalse('[sourcecode language=' in content)
replaced_content = """Hello World.
-
-~~~~~~~~~~~~{.Python}
+```Python
import sys
print sys.version
-~~~~~~~~~~~~
-"""
-
+```"""
self.assertEqual(content, replaced_content)
def test_transform_caption(self):