Improve content helper test

pull/1/head
Thomas Sileo 2018-06-16 13:44:31 +02:00
rodzic adfa3c66f7
commit 479000d418
1 zmienionych plików z 22 dodań i 0 usunięć

Wyświetl plik

@ -50,3 +50,25 @@ def test_little_content_helper_mention(_):
"type": "Mention",
}
]
@mock.patch(
"little_boxes.content_helper.get_actor_url", return_value="https://microblog.pub"
)
def test_little_content_helper_tag(_):
back = InMemBackend()
ap.use_backend(back)
content, tags = content_helper.parse_markdown("hello #activitypub")
base_url = back.base_url()
assert content == (
f'<p>hello <a href="{base_url}/tags/activitypub" class="mention hashtag" rel="tag">#'
f"<span>activitypub</span></a></p>"
)
assert tags == [
{
"href": f"{base_url}/tags/activitypub",
"name": "#activitypub",
"type": "Hashtag",
}
]