Fix test collection for CMS in python 3. (#21338)

This commit is contained in:
Feanil Patel
2019-08-13 13:54:49 -04:00
committed by GitHub
parent ecb65a4fff
commit 602970ed90
4 changed files with 17 additions and 16 deletions

View File

@@ -63,9 +63,9 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
u'data-locator="{0}" data-course-key="{0.course_key}">'.format(self.child_container.location)
),
expected_breadcrumbs=(
ur'<a href="/course/{course}{section_parameters}" class="{classes}">\s*Week 1\s*</a>\s*'
ur'<a href="/course/{course}{subsection_parameters}" class="{classes}">\s*Lesson 1\s*</a>\s*'
ur'<a href="/container/{unit}" class="{classes}">\s*Unit\s*</a>'
u'<a href="/course/{course}{section_parameters}" class="{classes}">\\s*Week 1\\s*</a>\\s*'
u'<a href="/course/{course}{subsection_parameters}" class="{classes}">\\s*Lesson 1\\s*</a>\\s*'
u'<a href="/container/{unit}" class="{classes}">\\s*Unit\\s*</a>'
).format(
course=re.escape(six.text_type(self.course.id)),
unit=re.escape(six.text_type(self.vertical.location)),
@@ -91,10 +91,10 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
u'data-locator="{0}" data-course-key="{0.course_key}">'.format(draft_container.location)
),
expected_breadcrumbs=(
ur'<a href="/course/{course}{section_parameters}" class="{classes}">\s*Week 1\s*</a>\s*'
ur'<a href="/course/{course}{subsection_parameters}" class="{classes}">\s*Lesson 1\s*</a>\s*'
ur'<a href="/container/{unit}" class="{classes}">\s*Unit\s*</a>\s*'
ur'<a href="/container/{split_test}" class="{classes}">\s*Split Test\s*</a>'
u'<a href="/course/{course}{section_parameters}" class="{classes}">\\s*Week 1\\s*</a>\\s*'
u'<a href="/course/{course}{subsection_parameters}" class="{classes}">\\s*Lesson 1\\s*</a>\\s*'
u'<a href="/container/{unit}" class="{classes}">\\s*Unit\\s*</a>\\s*'
u'<a href="/container/{split_test}" class="{classes}">\\s*Split Test\\s*</a>'
).format(
course=re.escape(six.text_type(self.course.id)),
unit=re.escape(six.text_type(self.vertical.location)),

View File

@@ -2,6 +2,7 @@
from __future__ import absolute_import
import json
import re
from datetime import datetime, timedelta
import ddt
@@ -255,8 +256,8 @@ class GetItemTest(ItemTest):
html,
# The instance of the wrapper class will have an auto-generated ID. Allow any
# characters after wrapper.
ur'"/container/{}" class="action-button">\s*<span class="action-button-text">View</span>'.format(
wrapper_usage_key
u'"/container/{}" class="action-button">\\s*<span class="action-button-text">View</span>'.format(
re.escape(six.text_type(wrapper_usage_key))
)
)

View File

@@ -35,7 +35,7 @@ from xmodule.video_module.transcripts_utils import (
TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex
SRT_TRANSCRIPT_CONTENT = """0
SRT_TRANSCRIPT_CONTENT = b"""0
00:00:10,500 --> 00:00:13,000
Elephant's Dream

View File

@@ -624,13 +624,13 @@ class Transcript(object):
"""
Container for transcript methods.
"""
SRT = 'srt'
TXT = 'txt'
SJSON = 'sjson'
SRT = u'srt'
TXT = u'txt'
SJSON = u'sjson'
mime_types = {
SRT: 'application/x-subrip; charset=utf-8',
TXT: 'text/plain; charset=utf-8',
SJSON: 'application/json',
SRT: u'application/x-subrip; charset=utf-8',
TXT: u'text/plain; charset=utf-8',
SJSON: u'application/json',
}
@staticmethod