def test_links_stripped(self): # Link with markup. s = u'a <a href="http://example.com">link</a> with markup' x = NoLinksNoMarkupTranslation(localized_string=s) eq_(x.__html__(), u'a with markup') # Text link. s = u'a text http://example.com link' x = NoLinksNoMarkupTranslation(localized_string=s) eq_(x.__html__(), u'a text link') # Text link, markup link, forbidden tags and bad markup. s = (u'a <a href="http://example.com">link</a> with markup, a text ' u'http://example.com link, <b>with forbidden tags</b>, ' u'<script>forbidden tags</script> and <http://bad.markup.com') x = NoLinksNoMarkupTranslation(localized_string=s) eq_(x.__html__(), u'a with markup, a text link, ' u'<b>with forbidden tags</b>, ' u'<script>forbidden tags</script> and')
def test_forbidden_tags(self): s = u'<script>some naughty xss</script> <b>bold</b>' x = NoLinksNoMarkupTranslation(localized_string=s) eq_(x.__html__(), '<script>some naughty xss</script> ' '<b>bold</b>')
def test_forbidden_tags(self): s = u'<script>some naughty xss</script> <b>bold</b>' x = NoLinksNoMarkupTranslation(localized_string=s) eq_( x.__html__(), '<script>some naughty xss</script> ' '<b>bold</b>')