Skip to content

Commit 87e5131

Browse files
author
Maari Tamm
committed
Update tests for URL handling in safe mode
In version 2.5.4, markdown2 has added better handling for URLs containing a "+" sign (trentm/python-markdown2#623) Update our tests accordingly.
1 parent cad258c commit 87e5131

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

requirements/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ edx-i18n-tools<1.6
66
Mako<=1.3.10
77
bleach<=6.2.0
88
django<=4.3
9+
markdown2>=2.5.4

tests/test_basics.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,8 @@ def test_render_url_safe_mode_replace(self):
185185
with patch('markdown_xblock.html.get_xblock_settings') as get_settings_mock:
186186
get_settings_mock.return_value = settings
187187
fragment = block.student_view()
188-
# in replace mode, "+" in URLs turns into whitespace
189188
self.assertIn(
190-
'<a href="https://test.com/courses/course-v1:Org Class Version/about">test1</a>',
189+
'<a href="https://test.com/courses/course-v1:Org+Class+Version/about">test1</a>',
191190
fragment.content
192191
)
193192
self.assertIn(
@@ -210,9 +209,8 @@ def test_render_url_safe_mode_escape(self):
210209
with patch('markdown_xblock.html.get_xblock_settings') as get_settings_mock:
211210
get_settings_mock.return_value = settings
212211
fragment = block.student_view()
213-
# in escape mode, "+" in URLs turns into whitespace
214212
self.assertIn(
215-
'<a href="https://test.com/courses/course-v1:Org Class Version/about">test1</a>',
213+
'<a href="https://test.com/courses/course-v1:Org+Class+Version/about">test1</a>',
216214
fragment.content
217215
)
218216
self.assertIn(

0 commit comments

Comments
 (0)