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("hello");' 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)