def test_external_text_link(self, get_outgoing_url_mock): get_outgoing_url_mock.return_value = 'http://external.url' s = u'<b>markup</b> http://example.com' x = PurifiedTranslation(localized_string=s) eq_(x.__html__(), u'<b>markup</b> <a rel="nofollow" ' u'href="http://external.url">http://example.com</a>')
def test_external_text_link(self): s = u'<b>markup</b> http://example.com' x = PurifiedTranslation(localized_string=s) eq_( x.__html__(), u'<b>markup</b> <a href="http://example.com">http://example.com</a>' )
def test_internal_link(self): s = u'<b>markup</b> <a href="http://addons.mozilla.org/foo">bar</a>' x = PurifiedTranslation(localized_string=s) eq_(x.__html__(), u'<b>markup</b> <a href="http://addons.mozilla.org/foo">bar</a>')
def test_forbidden_tags(self): s = u'<script>some naughty xss</script>' x = PurifiedTranslation(localized_string=s) eq_(x.__html__(), '<script>some naughty xss</script>')
def test_allowed_tags(self): s = u'<b>bold text</b> or <code>code</code>' x = PurifiedTranslation(localized_string=s) eq_(x.__html__(), u'<b>bold text</b> or <code>code</code>')
def test_raw_text(self): s = u' This is some text ' x = PurifiedTranslation(localized_string=s) eq_(x.__html__(), 'This is some text')
def test_external_text_link(self): s = u'<b>markup</b> http://example.com' x = PurifiedTranslation(localized_string=s) eq_(x.__html__(), u'<b>markup</b> ' u'<a href="http://example.com">http://example.com</a>')