forked from retoor/devplacepy
ticket #152 attempt 1
This commit is contained in:
@@ -263,3 +263,46 @@ def test_xss_legitimate_link_survives_audit():
|
||||
out = str(render_content("see https://example.com/page ok"))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert_no_executable_html(out)
|
||||
|
||||
|
||||
def test_bare_url_with_trailing_period():
|
||||
out = str(render_content("see https://example.com/page."))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert "</a>." in out
|
||||
assert "https://example.com/page.</a>" not in out
|
||||
|
||||
|
||||
def test_bare_url_with_trailing_comma():
|
||||
out = str(render_content("check https://example.com/page,"))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert "</a>," in out
|
||||
|
||||
|
||||
def test_bare_url_with_trailing_exclamation():
|
||||
out = str(render_content("look https://example.com/page!"))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert "</a>!" in out
|
||||
|
||||
|
||||
def test_bare_url_with_trailing_question_mark():
|
||||
out = str(render_content("did you see https://example.com/page?"))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert "</a>?" in out
|
||||
|
||||
|
||||
def test_bare_url_with_trailing_paren():
|
||||
out = str(render_content("see (https://example.com/page)"))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert "</a>)" in out
|
||||
|
||||
|
||||
def test_bare_url_with_trailing_multiple_punctuation():
|
||||
out = str(render_content("visit https://example.com/page..."))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert "</a>..." in out
|
||||
|
||||
|
||||
def test_bare_url_without_trailing_punctuation_unchanged():
|
||||
out = str(render_content("see https://example.com/page ok"))
|
||||
assert 'href="https://example.com/page"' in out
|
||||
assert "https://example.com/page</a> " in out
|
||||
|
||||
Reference in New Issue
Block a user