Adds test for misinterpreted links

This commit is contained in:
Mouse Reeve 2021-07-07 09:47:07 -07:00
parent 52713ec8d5
commit b3cd9483d3

View file

@ -8,6 +8,7 @@ from bookwyrm import forms, models, views
from bookwyrm.settings import DOMAIN
# pylint: disable=invalid-name
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
class StatusViews(TestCase):
"""viewing and creating statuses"""
@ -318,6 +319,15 @@ class StatusViews(TestCase):
'<p><em>hi</em> and <a href="http://fish.com">fish.com</a> ' "is rad</p>",
)
def test_to_markdown_detect_url(self, _):
"""this is mostly handled in other places, but nonetheless"""
text = "http://fish.com/@hello#okay"
result = views.status.to_markdown(text)
self.assertEqual(
result,
'<p><a href="http://fish.com/@hello#okay">fish.com/@hello#okay</a></p>',
)
def test_to_markdown_link(self, _):
"""this is mostly handled in other places, but nonetheless"""
text = "[hi](http://fish.com) is <marquee>rad</marquee>"