fix(tests): Update more tests to conform with nh3 behaviour

This commit is contained in:
Alex Leach 2025-11-21 23:47:23 +00:00
parent a5ef0104f1
commit 8a82699640
No known key found for this signature in database
GPG key ID: CBB1F1542760286C
2 changed files with 3 additions and 2 deletions

View file

@ -262,6 +262,7 @@ class TestDocument(IntegrationTestCase):
def test_xss_filter(self):
d = self.test_insert()
subject = d.subject
# script
xss = '<script>alert("XSS")</script>'
@ -271,7 +272,7 @@ class TestDocument(IntegrationTestCase):
d.reload()
self.assertTrue(xss not in d.subject)
self.assertTrue(escaped_xss in d.subject)
self.assertEqual(subject, d.subject)
# onload
xss = '<div onload="alert("XSS")">Test</div>'

View file

@ -508,7 +508,7 @@ class TestHTMLUtils(IntegrationTestCase):
sample = """<h1>Hello</h1><p>Para</p><a href="http://test.com">text</a>"""
clean = clean_email_html(sample)
self.assertTrue("<h1>Hello</h1>" in clean)
self.assertTrue('<a href="http://test.com">text</a>' in clean)
self.assertTrue('<a href="http://test.com" rel="noopener noreferrer">text</a>' in clean)
def test_sanitize_html(self):
from frappe.utils.html_utils import sanitize_html