def test_mixed(self):
     text = '<p><script>alert("xss")</script></p>'
     result = safe_html(text)
     eq_(
         result,
         text
         .replace('<script>', '&lt;script&gt;')
         .replace('</script>', '&lt;/script&gt;')
     )
 def test_mixed(self):
     text = '<p><script>alert("xss")</script></p>'
     result = safe_html(text)
     eq_(
         result,
         text
         .replace('<script>', '&lt;script&gt;')
         .replace('</script>', '&lt;/script&gt;')
     )
 def test_disallowed_html(self):
     text = '<script>alert("xss")</script>'
     result = safe_html(text)
     eq_(result, text.replace('<', '&lt;').replace('>', '&gt;'))
 def test_allowed_html(self):
     text = '<p>This <a href="http://peterbe.com">is</a> a<br>link.</p>'
     result = safe_html(text)
     eq_(result, text)
 def test_basics(self):
     text = ''
     result = safe_html(text)
     ok_(isinstance(result, jinja2.Markup))
     eq_(result, '')
 def test_disallowed_html(self):
     text = '<script>alert("xss")</script>'
     result = safe_html(text)
     eq_(result, text.replace('<', '&lt;').replace('>', '&gt;'))
 def test_allowed_html(self):
     text = '<p>This <a href="http://peterbe.com">is</a> a<br>link.</p>'
     result = safe_html(text)
     eq_(result, text)
 def test_basics(self):
     text = ''
     result = safe_html(text)
     ok_(isinstance(result, jinja2.Markup))
     eq_(result, '')