test: fix the tests

This commit is contained in:
souliane 2015-04-17 19:06:39 +02:00
commit f34a5b8aaf

View file

@ -61,7 +61,7 @@ class SanitisationTest(helpers.SatTestCase):
self.text_syntaxes = plugin_misc_text_syntaxes.TextSyntaxes(self.host)
def test_xhtml_sanitise(self):
expected = """<div>
expected = u"""<div>
<style>/* deleted */</style>
<body>
<a href="">a link</a>
@ -81,7 +81,7 @@ class SanitisationTest(helpers.SatTestCase):
return d
def test_styles_sanitise(self):
expected = """<p style="color: blue">test <strong>retest</strong><br/><span style="color: #cf2828; font-size: 3px; color: red; color: red !important; font-size: 100px !important; font-size: 100%; font-size: 100px; font-size: 100; font-size: 100 %; color: rgba(0, 0, 0, 0.1); color: rgb(35,79,255); background-color: no-repeat"> toto </span></p>"""
expected = u"""<p style="color: blue">test <strong>retest</strong><br/><span style="color: #cf2828; font-size: 3px; color: red; color: red !important; font-size: 100px !important; font-size: 100%; font-size: 100px; font-size: 100; font-size: 100 %; color: rgba(0, 0, 0, 0.1); color: rgb(35,79,255); background-color: no-repeat"> toto </span></p>"""
d = self.text_syntaxes.clean_xhtml(self.EVIL_HTML2)
d.addCallback(self.assertEqualXML, expected)
@ -100,11 +100,11 @@ class SanitisationTest(helpers.SatTestCase):
return d
def test_removeXHTMLMarkups(self):
expected = """ a link another link a paragraph secret EVIL! of EVIL! Password: annoying EVIL!spam spam SPAM! """
expected = u""" a link another link a paragraph secret EVIL! of EVIL! Password: annoying EVIL!spam spam SPAM! """
result = self.text_syntaxes._removeMarkups(self.EVIL_HTML1)
self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip())
expected = """test retest toto"""
expected = u"""test retest toto"""
result = self.text_syntaxes._removeMarkups(self.EVIL_HTML2)
self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip())