mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-22 23:30:59 +00:00
4ad4f468a4
Also suppress using external <a> tags for now, until we can separate them from hashtags properly.
21 lines
625 B
Python
21 lines
625 B
Python
from core.html import html_to_plaintext, sanitize_html
|
|
|
|
|
|
def test_html_to_plaintext():
|
|
|
|
assert html_to_plaintext("<p>Hi!</p>") == "Hi!"
|
|
assert html_to_plaintext("<p>Hi!<br>There</p>") == "Hi!\nThere"
|
|
assert (
|
|
html_to_plaintext("<p>Hi!</p>\n\n<p>How are you?</p>") == "Hi!\n\nHow are you?"
|
|
)
|
|
|
|
assert (
|
|
html_to_plaintext("<p>Hi!</p>\n\n<p>How are<br> you?</p><p>today</p>")
|
|
== "Hi!\n\nHow are\n you?\n\ntoday"
|
|
)
|
|
|
|
|
|
def test_sanitize_post():
|
|
|
|
assert sanitize_html("<p>Hello!</p>") == "<p>Hello!</p>"
|
|
assert sanitize_html("<p>It's great</p>") == "<p>It's great</p>"
|