def test_mixed(self): text = '<p><script>alert("xss")</script></p>' result = safe_html(text) eq_( result, text.replace('<script>', '<script>').replace('</script>', '</script>'))
def test_mixed(self): text = '<p><script>alert("xss")</script></p>' result = safe_html(text) eq_( result, text .replace('<script>', '<script>') .replace('</script>', '</script>') )
def test_disallowed_html(self): text = '<script>alert("xss")</script>' result = safe_html(text) eq_(result, text.replace('<', '<').replace('>', '>'))
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, '')