from core.html import html_to_plaintext, sanitize_html def test_html_to_plaintext(): assert html_to_plaintext("
Hi!
") == "Hi!" assert html_to_plaintext("Hi!
There
Hi!
\n\nHow are you?
") == "Hi!\n\nHow are you?" ) assert ( html_to_plaintext("Hi!
\n\nHow are
you?
today
") == "Hi!\n\nHow are\n you?\n\ntoday" ) def test_sanitize_post(): assert sanitize_html("Hello!
") == "Hello!
" assert sanitize_html("It's great
") == "It's great
" # Note that we only want to linkify things with protocol prefixes to prevent # too many false positives. assert sanitize_html("test.com
") == "test.com
" assert ( sanitize_html("https://test.com
") == '' ) assert ( sanitize_html("@someone@subdomain.some-domain.com
") == "@someone@subdomain.some-domain.com
" )