fix: fix is_safe_url and urlquote warnings (#33041)
* fix: fix is_safe_url and urlquote warnings * fix: replace urlquote with quote
This commit is contained in:
@@ -9,8 +9,8 @@ from unittest.mock import Mock, patch
|
||||
|
||||
from django.http import Http404
|
||||
from django.test.client import RequestFactory
|
||||
from django.utils import http
|
||||
from pytz import UTC
|
||||
from urllib.parse import quote
|
||||
|
||||
import cms.djangoapps.contentstore.views.component as views
|
||||
from cms.djangoapps.contentstore.tests.test_libraries import LibraryTestCase
|
||||
@@ -67,10 +67,10 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
|
||||
'<a href="/course/{course}{subsection_parameters}">Lesson 1</a>'
|
||||
).format(
|
||||
course=re.escape(str(self.course.id)),
|
||||
section_parameters=re.escape('?show={}'.format(http.urlquote(
|
||||
section_parameters=re.escape('?show={}'.format(quote(
|
||||
str(self.chapter.location).encode()
|
||||
))),
|
||||
subsection_parameters=re.escape('?show={}'.format(http.urlquote(
|
||||
subsection_parameters=re.escape('?show={}'.format(quote(
|
||||
str(self.sequential.location).encode()
|
||||
))),
|
||||
),
|
||||
@@ -97,7 +97,7 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
|
||||
).format(
|
||||
course=re.escape(str(self.course.id)),
|
||||
unit_parameters=re.escape(str(self.vertical.location)),
|
||||
subsection_parameters=re.escape('?show={}'.format(http.urlquote(
|
||||
subsection_parameters=re.escape('?show={}'.format(quote(
|
||||
str(self.sequential.location).encode()
|
||||
))),
|
||||
),
|
||||
|
||||
@@ -3,7 +3,7 @@ Unit tests for helpers.py.
|
||||
"""
|
||||
|
||||
|
||||
from django.utils import http
|
||||
from urllib.parse import quote
|
||||
|
||||
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
|
||||
from xmodule.modulestore.tests.factories import BlockFactory, LibraryFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
@@ -27,7 +27,7 @@ class HelpersTestCase(CourseTestCase):
|
||||
display_name="Week 1")
|
||||
self.assertEqual(
|
||||
xblock_studio_url(chapter),
|
||||
f'{course_url}?show={http.urlquote(str(chapter.location).encode())}'
|
||||
f'{course_url}?show={quote(str(chapter.location).encode())}'
|
||||
)
|
||||
|
||||
# Verify sequential URL
|
||||
@@ -35,7 +35,7 @@ class HelpersTestCase(CourseTestCase):
|
||||
display_name="Lesson 1")
|
||||
self.assertEqual(
|
||||
xblock_studio_url(sequential),
|
||||
f'{course_url}?show={http.urlquote(str(sequential.location).encode())}'
|
||||
f'{course_url}?show={quote(str(sequential.location).encode())}'
|
||||
)
|
||||
|
||||
# Verify unit URL
|
||||
|
||||
Reference in New Issue
Block a user