comparison src/test/test_plugin_misc_text_syntaxes.py @ 841:831f208b4ea3

plugin text_syntaxes: html2text was breaking the long URLs
author souliane <souliane@mailoo.org>
date Thu, 13 Feb 2014 12:29:14 +0100
parents c4b22aedb7d7
children 7ea7053dda88
comparison
equal deleted inserted replaced
840:58b4568ed4f2 841:831f208b4ea3
84 84
85 d = self.text_syntaxes.clean_xhtml(self.EVIL_HTML2) 85 d = self.text_syntaxes.clean_xhtml(self.EVIL_HTML2)
86 d.addCallback(self.assertEqualXML, expected) 86 d.addCallback(self.assertEqualXML, expected)
87 return d 87 return d
88 88
89 def test_html2text(self):
90 """Check that html2text is not inserting \n in the middle of that link.
91 By default lines are truncated after the 79th characters."""
92 source = "<img src=\"http://sat.goffi.org/static/images/screenshots/libervia/libervia_discussions.png\" alt=\"sat\"/>"
93 expected = "![sat](http://sat.goffi.org/static/images/screenshots/libervia/libervia_discussions.png)"
94 d = self.text_syntaxes.convert(source, self.text_syntaxes.SYNTAX_XHTML, self.text_syntaxes.SYNTAX_MARKDOWN)
95 d.addCallback(self.assertEqual, expected)
96 return d
97
89 def test_removeXHTMLMarkups(self): 98 def test_removeXHTMLMarkups(self):
90 expected = """ a link another link a paragraph secret EVIL! of EVIL! Password: annoying EVIL!spam spam SPAM! """ 99 expected = """ a link another link a paragraph secret EVIL! of EVIL! Password: annoying EVIL!spam spam SPAM! """
91 result = self.text_syntaxes._removeMarkups(self.EVIL_HTML1) 100 result = self.text_syntaxes._removeMarkups(self.EVIL_HTML1)
92 self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip()) 101 self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip())
93 102