From d2eba789ffb5e902dd927a4f778b100cceb8d5df Mon Sep 17 00:00:00 2001 From: Mubbshar Anwar <78487564+mubbsharanwar@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:51:22 +0500 Subject: [PATCH] fix: fix test_html_tags_removal (#37209) --- .../tests/test_discussions_notifications.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py b/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py index 5e0640c64e..247bd23540 100644 --- a/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py +++ b/lms/djangoapps/discussion/rest_api/tests/test_discussions_notifications.py @@ -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):

Script test:

Some other content that should remain.

""" - expected_output = ('

This is a link to a page.

' - '

Here is an image:

' - '

Embedded video:

' - '

Script test: alert("hello");

' - '

Some other content that should remain.

') + excepted_script_quot = 'alert(&quot;hello&quot;);' if django.VERSION >= (5, 0) else 'alert("hello");' + expected_output = ( + f'

This is a link to a page.

' + f'

Here is an image:

' + f'

Embedded video:

' + f'

Script test: {excepted_script_quot}

' + f'

Some other content that should remain.

' + ) result = clean_thread_html_body(html_body)