Beispiel #1
0
 def test_allowed_tags(self, get_outgoing_url_mock):
     get_outgoing_url_mock.return_value = 'http://external.url'
     s = u'<a href="http://example.com">bar</a>'
     x = LinkifiedTranslation(localized_string=s)
     doc = pq(x.__html__())
     links = doc('a[href="http://external.url"][rel="nofollow"]')
     assert links[0].text == 'bar'
Beispiel #2
0
 def test_forbidden_tags(self):
     s = u'<script>some naughty xss</script> <b>bold</b>'
     x = LinkifiedTranslation(localized_string=s)
     eq_(
         x.__html__(), '&lt;script&gt;some naughty xss&lt;/script&gt; '
         '&lt;b&gt;bold&lt;/b&gt;')
Beispiel #3
0
 def test_allowed_tags(self, get_outgoing_url_mock):
     get_outgoing_url_mock.return_value = 'http://external.url'
     s = u'<a href="http://example.com">bar</a>'
     x = LinkifiedTranslation(localized_string=s)
     eq_(x.__html__(),
         u'<a rel="nofollow" href="http://external.url">bar</a>')