1
0
Fork 0

Adds test for links with # symbols

This commit is contained in:
Mouse Reeve 2023-03-29 08:39:41 -07:00
parent 42dd199084
commit 8a0e88db83
2 changed files with 30 additions and 12 deletions

View file

@ -456,14 +456,24 @@ http://www.fish.com/"""
views.status.format_links(url), f'<a href="{url}">{url[8:]}</a>'
)
def test_format_links_with_at_symbol(self, *_):
def test_format_mentions_with_at_symbol_links(self, *_):
"""A link with an @username shouldn't treat the username as a mention"""
content = "a link to https://www.example.com/user/@mouse"
content = "a link to https://example.com/user/@mouse"
mentions = views.status.find_mentions(self.local_user, content)
# pylint: disable=line-too-long
self.assertEqual(
views.status.format_mentions(content, mentions),
'a link to <a href="https://www.example.com/user/@mouse">www.example.com/user/@mouse</a>'
'a link to <a href="https://example.com/user/@mouse">www.example.com/user/@mouse</a>',
)
def test_format_hashtag_with_pound_symbol_links(self, *_):
"""A link with an @username shouldn't treat the username as a mention"""
content = "a link to https://example.com/page#anchor"
hashtags = views.status.find_or_create_hashtags(content)
# pylint: disable=line-too-long
self.assertEqual(
views.status.format_hashtags(content, hashtags),
'a link to <a href="https://example.com/page#anchor">example.com/page#anchor</a>',
)
def test_to_markdown(self, *_):