Mercurial > libervia-backend
comparison libervia/backend/test/test_plugin_misc_text_syntaxes.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children |
comparison
equal
deleted
inserted
replaced
4269:64a85ce8be70 | 4270:0d7bb4df2343 |
---|---|
57 | 57 |
58 EVIL_HTML2 = """<p style='display: None; test: blah; background: url(: alert()); color: blue;'>test <strong>retest</strong><br><span style="background-color: (alert('bouh')); titi; color: #cf2828; font-size: 3px; direction: !important; color: red; color: red !important; font-size: 100px !important; font-size: 100px ! important; font-size: 100%; font-size: 100ox; font-size: 100px; font-size: 100;;;; font-size: 100 %; color: 100 px 1.7em; color: rgba(0, 0, 0, 0.1); color: rgb(35,79,255); background-color: no-repeat; background-color: :alert(1); color: (alert('XSS')); color: (window.location='http://example.org/'); color: url(:window.location='http://example.org/'); "> toto </span></p>""" | 58 EVIL_HTML2 = """<p style='display: None; test: blah; background: url(: alert()); color: blue;'>test <strong>retest</strong><br><span style="background-color: (alert('bouh')); titi; color: #cf2828; font-size: 3px; direction: !important; color: red; color: red !important; font-size: 100px !important; font-size: 100px ! important; font-size: 100%; font-size: 100ox; font-size: 100px; font-size: 100;;;; font-size: 100 %; color: 100 px 1.7em; color: rgba(0, 0, 0, 0.1); color: rgb(35,79,255); background-color: no-repeat; background-color: :alert(1); color: (alert('XSS')); color: (window.location='http://example.org/'); color: url(:window.location='http://example.org/'); "> toto </span></p>""" |
59 | 59 |
60 def setUp(self): | 60 def setUp(self): |
61 self.host = helpers.FakeSAT() | 61 self.host = helpers.FakeSAT() |
62 importlib.reload(plugin_misc_text_syntaxes) # reload the plugin to avoid conflict error | 62 importlib.reload( |
63 plugin_misc_text_syntaxes | |
64 ) # reload the plugin to avoid conflict error | |
63 self.text_syntaxes = plugin_misc_text_syntaxes.TextSyntaxes(self.host) | 65 self.text_syntaxes = plugin_misc_text_syntaxes.TextSyntaxes(self.host) |
64 | 66 |
65 def test_xhtml_sanitise(self): | 67 def test_xhtml_sanitise(self): |
66 expected = """<div> | 68 expected = """<div> |
67 <style>/* deleted */</style> | 69 <style>/* deleted */</style> |