|
@ -3,6 +3,7 @@ |
|
|
|
|
|
|
|
|
from bs4 import BeautifulSoup |
|
|
from bs4 import BeautifulSoup |
|
|
|
|
|
|
|
|
|
|
|
from tildes.enums import BleachContext |
|
|
from tildes.lib.markdown import convert_markdown_to_safe_html |
|
|
from tildes.lib.markdown import convert_markdown_to_safe_html |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -389,3 +390,19 @@ def test_image_syntax_ignored(): |
|
|
|
|
|
|
|
|
assert "!<a" in processed |
|
|
assert "!<a" in processed |
|
|
assert "img" not in processed |
|
|
assert "img" not in processed |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_a_rel_removed_default_context(): |
|
|
|
|
|
"""Ensure a rel= attr is removed from an <a> tag by default.""" |
|
|
|
|
|
markdown = '<a href="http://example.com" rel="something">Link</a>' |
|
|
|
|
|
processed = convert_markdown_to_safe_html(markdown) |
|
|
|
|
|
|
|
|
|
|
|
assert "rel=" not in processed |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_a_rel_kept_user_bio_context(): |
|
|
|
|
|
"""Ensure a rel= attr is kept on an <a> tag in the user bio context.""" |
|
|
|
|
|
markdown = '<a href="http://example.com" rel="something">Link</a>' |
|
|
|
|
|
processed = convert_markdown_to_safe_html(markdown, BleachContext.USER_BIO) |
|
|
|
|
|
|
|
|
|
|
|
assert "rel=" in processed |