Perform byte/string conversions where Django is no longer tolerant

This commit is contained in:
Tim McCormack
2020-03-27 21:37:53 +00:00
parent 8d951ae8ae
commit 22c963a935
2 changed files with 11 additions and 5 deletions

View File

@@ -67,8 +67,12 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
u'<a href="/course/{course}{subsection_parameters}">Lesson 1</a>'
).format(
course=re.escape(six.text_type(self.course.id)),
section_parameters=re.escape(u'?show={}'.format(http.urlquote(self.chapter.location))),
subsection_parameters=re.escape(u'?show={}'.format(http.urlquote(self.sequential.location))),
section_parameters=re.escape(u'?show={}'.format(http.urlquote(
str(self.chapter.location).encode()
))),
subsection_parameters=re.escape(u'?show={}'.format(http.urlquote(
str(self.sequential.location).encode()
))),
),
)
@@ -93,7 +97,9 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
).format(
course=re.escape(six.text_type(self.course.id)),
unit_parameters=re.escape(str(self.vertical.location)),
subsection_parameters=re.escape(u'?show={}'.format(http.urlquote(self.sequential.location))),
subsection_parameters=re.escape(u'?show={}'.format(http.urlquote(
str(self.sequential.location).encode()
))),
),
)

View File

@@ -27,7 +27,7 @@ class HelpersTestCase(CourseTestCase):
display_name="Week 1")
self.assertEqual(
xblock_studio_url(chapter),
u'{}?show={}'.format(course_url, http.urlquote(chapter.location))
u'{}?show={}'.format(course_url, http.urlquote(str(chapter.location).encode()))
)
# Verify sequential URL
@@ -35,7 +35,7 @@ class HelpersTestCase(CourseTestCase):
display_name="Lesson 1")
self.assertEqual(
xblock_studio_url(sequential),
u'{}?show={}'.format(course_url, http.urlquote(sequential.location))
u'{}?show={}'.format(course_url, http.urlquote(str(sequential.location).encode()))
)
# Verify unit URL