comparison src/test/test_plugin_misc_text_syntaxes.py @ 856:7ea7053dda88

test: skip the test for markdown syntax if the module is not installed
author souliane <souliane@mailoo.org>
date Thu, 20 Feb 2014 16:37:05 +0100
parents 831f208b4ea3
children 069ad98b360d
comparison
equal deleted inserted replaced
855:03addfe98b64 856:7ea7053dda88
19 19
20 """ Plugin text syntaxes tests """ 20 """ Plugin text syntaxes tests """
21 21
22 from sat.test import helpers 22 from sat.test import helpers
23 from sat.plugins import plugin_misc_text_syntaxes 23 from sat.plugins import plugin_misc_text_syntaxes
24 from twisted.trial.unittest import SkipTest
24 import re 25 import re
25 26
26 27
27 class SanitisationTest(helpers.SatTestCase): 28 class SanitisationTest(helpers.SatTestCase):
28 29
89 def test_html2text(self): 90 def test_html2text(self):
90 """Check that html2text is not inserting \n in the middle of that link. 91 """Check that html2text is not inserting \n in the middle of that link.
91 By default lines are truncated after the 79th characters.""" 92 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 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 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 try:
96 d = self.text_syntaxes.convert(source, self.text_syntaxes.SYNTAX_XHTML, self.text_syntaxes.SYNTAX_MARKDOWN)
97 except plugin_misc_text_syntaxes.UnknownSyntax:
98 raise SkipTest("Markdown syntax is not available.")
95 d.addCallback(self.assertEqual, expected) 99 d.addCallback(self.assertEqual, expected)
96 return d 100 return d
97 101
98 def test_removeXHTMLMarkups(self): 102 def test_removeXHTMLMarkups(self):
99 expected = """ a link another link a paragraph secret EVIL! of EVIL! Password: annoying EVIL!spam spam SPAM! """ 103 expected = """ a link another link a paragraph secret EVIL! of EVIL! Password: annoying EVIL!spam spam SPAM! """