fix: fix test_html_tags_removal (#37209)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Unit tests for the DiscussionNotificationSender class
|
||||
"""
|
||||
import re
|
||||
import django
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
@@ -108,11 +109,14 @@ class TestCleanThreadHtmlBody(unittest.TestCase):
|
||||
<p>Script test: <script>alert("hello");</script></p>
|
||||
<p>Some other content that should remain.</p>
|
||||
"""
|
||||
expected_output = ('<p style="margin: 0">This is a link to a page.</p>'
|
||||
'<p style="margin: 0">Here is an image: </p>'
|
||||
'<p style="margin: 0">Embedded video: </p>'
|
||||
'<p style="margin: 0">Script test: alert("hello");</p>'
|
||||
'<p style="margin: 0">Some other content that should remain.</p>')
|
||||
excepted_script_quot = 'alert(&quot;hello&quot;);' if django.VERSION >= (5, 0) else 'alert("hello");'
|
||||
expected_output = (
|
||||
f'<p style="margin: 0">This is a link to a page.</p>'
|
||||
f'<p style="margin: 0">Here is an image: </p>'
|
||||
f'<p style="margin: 0">Embedded video: </p>'
|
||||
f'<p style="margin: 0">Script test: {excepted_script_quot}</p>'
|
||||
f'<p style="margin: 0">Some other content that should remain.</p>'
|
||||
)
|
||||
|
||||
result = clean_thread_html_body(html_body)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user