Mercurial > libervia-backend
comparison src/test/test_plugin_misc_text_syntaxes.py @ 1812:160b0d4c6520
plugin XEP-0071, XEP-0277: method clean_xhtml has been renamed to cleanXHTML
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 19 Jan 2016 11:51:07 +0100 |
parents | 821c77574ad9 |
children | 55440ee00905 |
comparison
equal
deleted
inserted
replaced
1811:90ae9a2462c2 | 1812:160b0d4c6520 |
---|---|
74 <a href="evil-site">spam spam SPAM!</a> | 74 <a href="evil-site">spam spam SPAM!</a> |
75 <img src="evil!"> | 75 <img src="evil!"> |
76 </img></body> | 76 </img></body> |
77 </div>""" | 77 </div>""" |
78 | 78 |
79 d = self.text_syntaxes.clean_xhtml(self.EVIL_HTML1) | 79 d = self.text_syntaxes.cleanXHTML(self.EVIL_HTML1) |
80 d.addCallback(self.assertEqualXML, expected, ignore_blank=True) | 80 d.addCallback(self.assertEqualXML, expected, ignore_blank=True) |
81 return d | 81 return d |
82 | 82 |
83 def test_styles_sanitise(self): | 83 def test_styles_sanitise(self): |
84 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>""" | 84 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>""" |
85 | 85 |
86 d = self.text_syntaxes.clean_xhtml(self.EVIL_HTML2) | 86 d = self.text_syntaxes.cleanXHTML(self.EVIL_HTML2) |
87 d.addCallback(self.assertEqualXML, expected) | 87 d.addCallback(self.assertEqualXML, expected) |
88 return d | 88 return d |
89 | 89 |
90 def test_html2text(self): | 90 def test_html2text(self): |
91 """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. |