Merge pull request #20981 from edx/INCR-330
INCR-330 python3 compatibility
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
"""
|
||||
Unit tests for the container page.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import datetime
|
||||
import re
|
||||
|
||||
import six
|
||||
from django.http import Http404
|
||||
from django.test.client import RequestFactory
|
||||
from django.utils import http
|
||||
@@ -64,8 +67,8 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
|
||||
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>'
|
||||
).format(
|
||||
course=re.escape(unicode(self.course.id)),
|
||||
unit=re.escape(unicode(self.vertical.location)),
|
||||
course=re.escape(six.text_type(self.course.id)),
|
||||
unit=re.escape(six.text_type(self.vertical.location)),
|
||||
classes='navigation-item navigation-link navigation-parent',
|
||||
section_parameters=re.escape(u'?show={}'.format(http.urlquote(self.chapter.location))),
|
||||
subsection_parameters=re.escape(u'?show={}'.format(http.urlquote(self.sequential.location))),
|
||||
@@ -93,9 +96,9 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
|
||||
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>'
|
||||
).format(
|
||||
course=re.escape(unicode(self.course.id)),
|
||||
unit=re.escape(unicode(self.vertical.location)),
|
||||
split_test=re.escape(unicode(self.child_container.location)),
|
||||
course=re.escape(six.text_type(self.course.id)),
|
||||
unit=re.escape(six.text_type(self.vertical.location)),
|
||||
split_test=re.escape(six.text_type(self.child_container.location)),
|
||||
classes=u'navigation-item navigation-link navigation-parent',
|
||||
section_parameters=re.escape(u'?show={}'.format(http.urlquote(self.chapter.location))),
|
||||
subsection_parameters=re.escape(u'?show={}'.format(http.urlquote(self.sequential.location))),
|
||||
@@ -223,6 +226,6 @@ class ContainerPageTestCase(StudioPageTestCase, LibraryTestCase):
|
||||
# Check 200 response if 'usage_key_string' is correct
|
||||
response = views.container_handler(
|
||||
request=request,
|
||||
usage_key_string=unicode(self.vertical.location)
|
||||
usage_key_string=six.text_type(self.vertical.location)
|
||||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
unit tests for course_info views and models.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
|
||||
from django.test.utils import override_settings
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"""
|
||||
Test module for Entrance Exams AJAX callback handler workflows
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.test.client import RequestFactory
|
||||
@@ -38,15 +42,15 @@ class EntranceExamHandlerTests(CourseTestCase, MilestonesTestCaseMixin):
|
||||
super(EntranceExamHandlerTests, self).setUp()
|
||||
self.course_key = self.course.id
|
||||
self.usage_key = self.course.location
|
||||
self.course_url = '/course/{}'.format(unicode(self.course.id))
|
||||
self.exam_url = '/course/{}/entrance_exam/'.format(unicode(self.course.id))
|
||||
self.course_url = '/course/{}'.format(six.text_type(self.course.id))
|
||||
self.exam_url = '/course/{}/entrance_exam/'.format(six.text_type(self.course.id))
|
||||
self.milestone_relationship_types = milestones_helpers.get_milestone_relationship_types()
|
||||
|
||||
def test_entrance_exam_milestone_addition(self):
|
||||
"""
|
||||
Unit Test: test addition of entrance exam milestone content
|
||||
"""
|
||||
parent_locator = unicode(self.course.location)
|
||||
parent_locator = six.text_type(self.course.location)
|
||||
created_block = create_xblock(
|
||||
parent_locator=parent_locator,
|
||||
user=self.user,
|
||||
@@ -56,8 +60,8 @@ class EntranceExamHandlerTests(CourseTestCase, MilestonesTestCaseMixin):
|
||||
)
|
||||
add_entrance_exam_milestone(self.course.id, created_block)
|
||||
content_milestones = milestones_helpers.get_course_content_milestones(
|
||||
unicode(self.course.id),
|
||||
unicode(created_block.location),
|
||||
six.text_type(self.course.id),
|
||||
six.text_type(created_block.location),
|
||||
self.milestone_relationship_types['FULFILLS']
|
||||
)
|
||||
self.assertTrue(len(content_milestones))
|
||||
@@ -67,7 +71,7 @@ class EntranceExamHandlerTests(CourseTestCase, MilestonesTestCaseMixin):
|
||||
"""
|
||||
Unit Test: test removal of entrance exam milestone content
|
||||
"""
|
||||
parent_locator = unicode(self.course.location)
|
||||
parent_locator = six.text_type(self.course.location)
|
||||
created_block = create_xblock(
|
||||
parent_locator=parent_locator,
|
||||
user=self.user,
|
||||
@@ -77,8 +81,8 @@ class EntranceExamHandlerTests(CourseTestCase, MilestonesTestCaseMixin):
|
||||
)
|
||||
add_entrance_exam_milestone(self.course.id, created_block)
|
||||
content_milestones = milestones_helpers.get_course_content_milestones(
|
||||
unicode(self.course.id),
|
||||
unicode(created_block.location),
|
||||
six.text_type(self.course.id),
|
||||
six.text_type(created_block.location),
|
||||
self.milestone_relationship_types['FULFILLS']
|
||||
)
|
||||
self.assertEqual(len(content_milestones), 1)
|
||||
@@ -87,8 +91,8 @@ class EntranceExamHandlerTests(CourseTestCase, MilestonesTestCaseMixin):
|
||||
request.user = user
|
||||
remove_entrance_exam_milestone_reference(request, self.course.id)
|
||||
content_milestones = milestones_helpers.get_course_content_milestones(
|
||||
unicode(self.course.id),
|
||||
unicode(created_block.location),
|
||||
six.text_type(self.course.id),
|
||||
six.text_type(created_block.location),
|
||||
self.milestone_relationship_types['FULFILLS']
|
||||
)
|
||||
self.assertEqual(len(content_milestones), 0)
|
||||
@@ -108,9 +112,9 @@ class EntranceExamHandlerTests(CourseTestCase, MilestonesTestCaseMixin):
|
||||
self.assertTrue(metadata['entrance_exam_enabled'])
|
||||
self.assertIsNotNone(metadata['entrance_exam_minimum_score_pct'])
|
||||
self.assertIsNotNone(metadata['entrance_exam_id']['value'])
|
||||
self.assertTrue(len(milestones_helpers.get_course_milestones(unicode(self.course.id))))
|
||||
self.assertTrue(len(milestones_helpers.get_course_milestones(six.text_type(self.course.id))))
|
||||
content_milestones = milestones_helpers.get_course_content_milestones(
|
||||
unicode(self.course.id),
|
||||
six.text_type(self.course.id),
|
||||
metadata['entrance_exam_id']['value'],
|
||||
self.milestone_relationship_types['FULFILLS']
|
||||
)
|
||||
@@ -176,11 +180,11 @@ class EntranceExamHandlerTests(CourseTestCase, MilestonesTestCaseMixin):
|
||||
)
|
||||
user.set_password('test')
|
||||
user.save()
|
||||
milestones = milestones_helpers.get_course_milestones(unicode(self.course_key))
|
||||
milestones = milestones_helpers.get_course_milestones(six.text_type(self.course_key))
|
||||
self.assertEqual(len(milestones), 1)
|
||||
milestone_key = '{}.{}'.format(milestones[0]['namespace'], milestones[0]['name'])
|
||||
paths = milestones_helpers.get_course_milestones_fulfillment_paths(
|
||||
unicode(self.course_key),
|
||||
six.text_type(self.course_key),
|
||||
milestones_helpers.serialize_user(user)
|
||||
)
|
||||
|
||||
|
||||
@@ -3,22 +3,26 @@
|
||||
"""
|
||||
Group Configuration Tests.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
from operator import itemgetter
|
||||
|
||||
import ddt
|
||||
import six
|
||||
from mock import patch
|
||||
from six.moves import range
|
||||
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from contentstore.course_group_config import GroupConfiguration, CONTENT_GROUP_CONFIGURATION_NAME, ENROLLMENT_SCHEME
|
||||
from contentstore.course_group_config import CONTENT_GROUP_CONFIGURATION_NAME, ENROLLMENT_SCHEME, GroupConfiguration
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
from openedx.features.content_type_gating.helpers import CONTENT_GATING_PARTITION_ID
|
||||
from openedx.features.content_type_gating.partitions import CONTENT_TYPE_GATING_SCHEME
|
||||
from xmodule.partitions.partitions import Group, UserPartition, ENROLLMENT_TRACK_PARTITION_ID
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.validation import StudioValidation, StudioValidationMessage
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID, Group, UserPartition
|
||||
from xmodule.validation import StudioValidation, StudioValidationMessage
|
||||
|
||||
GROUP_CONFIGURATION_JSON = {
|
||||
u'name': u'Test name',
|
||||
@@ -160,7 +164,7 @@ class HelperMethods(object):
|
||||
i, 'Name ' + str(i), 'Description ' + str(i),
|
||||
[Group(0, 'Group A'), Group(1, 'Group B'), Group(2, 'Group C')],
|
||||
scheme=None, scheme_id=scheme_id
|
||||
) for i in xrange(count)
|
||||
) for i in range(count)
|
||||
]
|
||||
self.course.user_partitions = partitions
|
||||
self.save_course()
|
||||
@@ -338,7 +342,7 @@ class GroupConfigurationsListHandlerTestCase(CourseTestCase, GroupConfigurations
|
||||
"""
|
||||
group_config = dict(GROUP_CONFIGURATION_JSON)
|
||||
group_config['scheme'] = scheme_id
|
||||
group_config.setdefault('parameters', {})['course_id'] = unicode(self.course.id)
|
||||
group_config.setdefault('parameters', {})['course_id'] = six.text_type(self.course.id)
|
||||
response = self.client.ajax_post(
|
||||
self._url(),
|
||||
data=group_config
|
||||
@@ -655,7 +659,7 @@ class GroupConfigurationsDetailHandlerTestCase(CourseTestCase, GroupConfiguratio
|
||||
"""
|
||||
group_config = dict(GROUP_CONFIGURATION_JSON)
|
||||
group_config['scheme'] = scheme_id
|
||||
group_config.setdefault('parameters', {})['course_id'] = unicode(self.course.id)
|
||||
group_config.setdefault('parameters', {})['course_id'] = six.text_type(self.course.id)
|
||||
response = self.client.ajax_post(
|
||||
self._url(),
|
||||
data=group_config
|
||||
@@ -673,7 +677,7 @@ class GroupConfigurationsDetailHandlerTestCase(CourseTestCase, GroupConfiguratio
|
||||
"""
|
||||
group_config = dict(GROUP_CONFIGURATION_JSON)
|
||||
group_config['scheme'] = scheme_id
|
||||
group_config.setdefault('parameters', {})['course_id'] = unicode(self.course.id)
|
||||
group_config.setdefault('parameters', {})['course_id'] = six.text_type(self.course.id)
|
||||
response = self.client.put(
|
||||
self._url(cid=partition_id),
|
||||
data=json.dumps(group_config),
|
||||
@@ -1112,10 +1116,10 @@ class GroupConfigurationsUsageInfoTestCase(CourseTestCase, HelperMethods):
|
||||
# This used to cause an exception since the code assumed that
|
||||
# only one partition would be available.
|
||||
actual = GroupConfiguration.get_partitions_usage_info(self.store, self.course)
|
||||
self.assertEqual(actual.keys(), [0])
|
||||
self.assertEqual(list(actual.keys()), [0])
|
||||
|
||||
actual = GroupConfiguration.get_content_groups_items_usage_info(self.store, self.course)
|
||||
self.assertEqual(actual.keys(), [0])
|
||||
self.assertEqual(list(actual.keys()), [0])
|
||||
|
||||
def test_can_handle_duplicate_group_ids(self):
|
||||
# Create the user partitions
|
||||
@@ -1150,14 +1154,14 @@ class GroupConfigurationsUsageInfoTestCase(CourseTestCase, HelperMethods):
|
||||
# This used to cause an exception since the code assumed that
|
||||
# only one partition would be available.
|
||||
actual = GroupConfiguration.get_partitions_usage_info(self.store, self.course)
|
||||
self.assertEqual(actual.keys(), [0, 1])
|
||||
self.assertEqual(actual[0].keys(), [2])
|
||||
self.assertEqual(actual[1].keys(), [3])
|
||||
self.assertEqual(list(actual.keys()), [0, 1])
|
||||
self.assertEqual(list(actual[0].keys()), [2])
|
||||
self.assertEqual(list(actual[1].keys()), [3])
|
||||
|
||||
actual = GroupConfiguration.get_content_groups_items_usage_info(self.store, self.course)
|
||||
self.assertEqual(actual.keys(), [0, 1])
|
||||
self.assertEqual(actual[0].keys(), [2])
|
||||
self.assertEqual(actual[1].keys(), [3])
|
||||
self.assertEqual(list(actual.keys()), [0, 1])
|
||||
self.assertEqual(list(actual[0].keys()), [2])
|
||||
self.assertEqual(list(actual[1].keys()), [3])
|
||||
|
||||
|
||||
class GroupConfigurationsValidationTestCase(CourseTestCase, HelperMethods):
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
"""Tests for items views."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import ddt
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.http import Http404
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
from django.urls import reverse
|
||||
from mock import Mock, PropertyMock, patch
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.asides import AsideUsageKeyV2
|
||||
@@ -16,6 +19,7 @@ from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
|
||||
from pyquery import PyQuery
|
||||
from pytz import UTC
|
||||
from six import text_type
|
||||
from six.moves import range
|
||||
from web_fragments.fragment import Fragment
|
||||
from webob import Response
|
||||
from xblock.core import XBlockAside
|
||||
@@ -36,7 +40,7 @@ from contentstore.views.item import (
|
||||
_xblock_type_and_display_name,
|
||||
add_container_page_publishing_info,
|
||||
create_xblock_info,
|
||||
highlights_setting,
|
||||
highlights_setting
|
||||
)
|
||||
from lms_xblock.mixin import NONSENSICAL_ACCESS_RESTRICTION
|
||||
from student.tests.factories import UserFactory
|
||||
@@ -106,7 +110,9 @@ class ItemTest(CourseTestCase):
|
||||
|
||||
def create_xblock(self, parent_usage_key=None, display_name=None, category=None, boilerplate=None):
|
||||
data = {
|
||||
'parent_locator': unicode(self.usage_key) if parent_usage_key is None else unicode(parent_usage_key),
|
||||
'parent_locator': six.text_type(
|
||||
self.usage_key
|
||||
)if parent_usage_key is None else six.text_type(parent_usage_key),
|
||||
'category': category
|
||||
}
|
||||
if display_name is not None:
|
||||
@@ -447,7 +453,7 @@ class GetItemTest(ItemTest):
|
||||
xblock (XBlock): An XBlock item.
|
||||
xblock_info (dict): A dict containing xblock information.
|
||||
"""
|
||||
self.assertEqual(unicode(xblock.location), xblock_info['id'])
|
||||
self.assertEqual(six.text_type(xblock.location), xblock_info['id'])
|
||||
self.assertEqual(xblock.display_name, xblock_info['display_name'])
|
||||
self.assertEqual(xblock.category, xblock_info['category'])
|
||||
|
||||
@@ -591,21 +597,21 @@ class DuplicateHelper(object):
|
||||
self.assertEqual(duplicated_asides[0].field13, 'aside1_default_value3')
|
||||
|
||||
self.assertNotEqual(
|
||||
unicode(original_item.location),
|
||||
unicode(duplicated_item.location),
|
||||
six.text_type(original_item.location),
|
||||
six.text_type(duplicated_item.location),
|
||||
"Location of duplicate should be different from original"
|
||||
)
|
||||
|
||||
# Parent will only be equal for root of duplicated structure, in the case
|
||||
# where an item is duplicated in-place.
|
||||
if parent_usage_key and unicode(original_item.parent) == unicode(parent_usage_key):
|
||||
if parent_usage_key and six.text_type(original_item.parent) == six.text_type(parent_usage_key):
|
||||
self.assertEqual(
|
||||
unicode(parent_usage_key), unicode(duplicated_item.parent),
|
||||
six.text_type(parent_usage_key), six.text_type(duplicated_item.parent),
|
||||
"Parent of duplicate should equal parent of source for root xblock when duplicated in-place"
|
||||
)
|
||||
else:
|
||||
self.assertNotEqual(
|
||||
unicode(original_item.parent), unicode(duplicated_item.parent),
|
||||
six.text_type(original_item.parent), six.text_type(duplicated_item.parent),
|
||||
"Parent duplicate should be different from source"
|
||||
)
|
||||
|
||||
@@ -622,7 +628,7 @@ class DuplicateHelper(object):
|
||||
len(duplicated_item.children),
|
||||
"Duplicated item differs in number of children"
|
||||
)
|
||||
for i in xrange(len(original_item.children)):
|
||||
for i in range(len(original_item.children)):
|
||||
if not self._check_equality(original_item.children[i], duplicated_item.children[i], is_child=True):
|
||||
return False
|
||||
duplicated_item.children = original_item.children
|
||||
@@ -650,8 +656,8 @@ class DuplicateHelper(object):
|
||||
"""
|
||||
# pylint: disable=no-member
|
||||
data = {
|
||||
'parent_locator': unicode(parent_usage_key),
|
||||
'duplicate_source_locator': unicode(source_usage_key)
|
||||
'parent_locator': six.text_type(parent_usage_key),
|
||||
'duplicate_source_locator': six.text_type(source_usage_key)
|
||||
}
|
||||
if display_name is not None:
|
||||
data['display_name'] = display_name
|
||||
@@ -862,8 +868,8 @@ class TestMoveItem(ItemTest):
|
||||
resp (JsonResponse): Response after the move operation is complete.
|
||||
"""
|
||||
data = {
|
||||
'move_source_locator': unicode(source_usage_key),
|
||||
'parent_locator': unicode(target_usage_key)
|
||||
'move_source_locator': six.text_type(source_usage_key),
|
||||
'parent_locator': six.text_type(target_usage_key)
|
||||
}
|
||||
if target_index is not None:
|
||||
data['target_index'] = target_index
|
||||
@@ -890,8 +896,8 @@ class TestMoveItem(ItemTest):
|
||||
response = self._move_component(source_usage_key, target_usage_key, target_index)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response = json.loads(response.content)
|
||||
self.assertEqual(response['move_source_locator'], unicode(source_usage_key))
|
||||
self.assertEqual(response['parent_locator'], unicode(target_usage_key))
|
||||
self.assertEqual(response['move_source_locator'], six.text_type(source_usage_key))
|
||||
self.assertEqual(response['parent_locator'], six.text_type(target_usage_key))
|
||||
self.assertEqual(response['source_index'], expected_index)
|
||||
|
||||
# Verify parent referance has been changed now.
|
||||
@@ -1149,7 +1155,7 @@ class TestMoveItem(ItemTest):
|
||||
"""
|
||||
Test move an item without specifying the target location.
|
||||
"""
|
||||
data = {'move_source_locator': unicode(self.html_usage_key)}
|
||||
data = {'move_source_locator': six.text_type(self.html_usage_key)}
|
||||
with self.assertRaises(InvalidKeyError):
|
||||
self.client.patch(
|
||||
reverse('xblock_handler'),
|
||||
@@ -1238,9 +1244,9 @@ class TestMoveItem(ItemTest):
|
||||
self.assert_move_item(self.html_usage_key, self.vert2_usage_key, insert_at)
|
||||
mock_logger.info.assert_called_with(
|
||||
u'MOVE: %s moved from %s to %s at %d index',
|
||||
unicode(self.html_usage_key),
|
||||
unicode(self.vert_usage_key),
|
||||
unicode(self.vert2_usage_key),
|
||||
six.text_type(self.html_usage_key),
|
||||
six.text_type(self.vert_usage_key),
|
||||
six.text_type(self.vert2_usage_key),
|
||||
insert_at
|
||||
)
|
||||
|
||||
@@ -1308,8 +1314,8 @@ class TestMoveItem(ItemTest):
|
||||
self.setup_course(default_store=store_type)
|
||||
|
||||
data = {
|
||||
'move_source_locator': unicode(self.usage_key.course_key.make_usage_key('html', 'html_test')),
|
||||
'parent_locator': unicode(self.vert2_usage_key)
|
||||
'move_source_locator': six.text_type(self.usage_key.course_key.make_usage_key('html', 'html_test')),
|
||||
'parent_locator': six.text_type(self.vert2_usage_key)
|
||||
}
|
||||
with self.assertRaises(ItemNotFoundError):
|
||||
self.client.patch(
|
||||
@@ -1554,7 +1560,13 @@ class TestEditItem(TestEditItemSetup):
|
||||
|
||||
resp = self.client.ajax_post(
|
||||
self.seq_update_url,
|
||||
data={'children': [unicode(self.problem_usage_key), unicode(unit2_usage_key), unicode(unit1_usage_key)]}
|
||||
data={
|
||||
'children': [
|
||||
six.text_type(self.problem_usage_key),
|
||||
six.text_type(unit2_usage_key),
|
||||
six.text_type(unit1_usage_key)
|
||||
]
|
||||
}
|
||||
)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
@@ -1577,7 +1589,7 @@ class TestEditItem(TestEditItemSetup):
|
||||
# move unit 1 from sequential1 to sequential2
|
||||
resp = self.client.ajax_post(
|
||||
self.seq2_update_url,
|
||||
data={'children': [unicode(unit_1_key), unicode(unit_2_key)]}
|
||||
data={'children': [six.text_type(unit_1_key), six.text_type(unit_2_key)]}
|
||||
)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
@@ -1600,7 +1612,7 @@ class TestEditItem(TestEditItemSetup):
|
||||
# adding orphaned unit 1 should return an error
|
||||
resp = self.client.ajax_post(
|
||||
self.seq2_update_url,
|
||||
data={'children': [unicode(unit_1_key)]}
|
||||
data={'children': [six.text_type(unit_1_key)]}
|
||||
)
|
||||
self.assertEqual(resp.status_code, 400)
|
||||
self.assertIn("Invalid data, possibly caused by concurrent authors", resp.content)
|
||||
@@ -1625,7 +1637,7 @@ class TestEditItem(TestEditItemSetup):
|
||||
# remove unit 2 should return an error
|
||||
resp = self.client.ajax_post(
|
||||
self.seq2_update_url,
|
||||
data={'children': [unicode(unit_1_key)]}
|
||||
data={'children': [six.text_type(unit_1_key)]}
|
||||
)
|
||||
self.assertEqual(resp.status_code, 400)
|
||||
self.assertIn("Invalid data, possibly caused by concurrent authors", resp.content)
|
||||
@@ -1793,7 +1805,7 @@ class TestEditItem(TestEditItemSetup):
|
||||
self.client.ajax_post(
|
||||
self.problem_update_url,
|
||||
data={
|
||||
'id': unicode(self.problem_usage_key),
|
||||
'id': six.text_type(self.problem_usage_key),
|
||||
'metadata': {},
|
||||
'data': "<p>Problem content draft.</p>"
|
||||
}
|
||||
@@ -1848,7 +1860,7 @@ class TestEditItem(TestEditItemSetup):
|
||||
resp = self.client.ajax_post(
|
||||
unit_update_url,
|
||||
data={
|
||||
'id': unicode(unit_usage_key),
|
||||
'id': six.text_type(unit_usage_key),
|
||||
'metadata': {},
|
||||
}
|
||||
)
|
||||
@@ -1868,7 +1880,7 @@ class TestEditItem(TestEditItemSetup):
|
||||
response = self.client.ajax_post(
|
||||
update_url,
|
||||
data={
|
||||
'id': unicode(video_usage_key),
|
||||
'id': six.text_type(video_usage_key),
|
||||
'metadata': {
|
||||
'saved_video_position': "Not a valid relative time",
|
||||
},
|
||||
@@ -1894,7 +1906,7 @@ class TestEditItemSplitMongo(TestEditItemSetup):
|
||||
"""
|
||||
view_url = reverse_usage_url("xblock_view_handler", self.problem_usage_key, {"view_name": STUDIO_VIEW})
|
||||
|
||||
for __ in xrange(3):
|
||||
for __ in range(3):
|
||||
resp = self.client.get(view_url, HTTP_ACCEPT='application/json')
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
content = json.loads(resp.content)
|
||||
@@ -1910,8 +1922,8 @@ class TestEditSplitModule(ItemTest):
|
||||
super(TestEditSplitModule, self).setUp()
|
||||
self.user = UserFactory()
|
||||
|
||||
self.first_user_partition_group_1 = Group(unicode(MINIMUM_STATIC_PARTITION_ID + 1), 'alpha')
|
||||
self.first_user_partition_group_2 = Group(unicode(MINIMUM_STATIC_PARTITION_ID + 2), 'beta')
|
||||
self.first_user_partition_group_1 = Group(six.text_type(MINIMUM_STATIC_PARTITION_ID + 1), 'alpha')
|
||||
self.first_user_partition_group_2 = Group(six.text_type(MINIMUM_STATIC_PARTITION_ID + 2), 'beta')
|
||||
self.first_user_partition = UserPartition(
|
||||
MINIMUM_STATIC_PARTITION_ID, 'first_partition', 'First Partition',
|
||||
[self.first_user_partition_group_1, self.first_user_partition_group_2]
|
||||
@@ -1919,9 +1931,9 @@ class TestEditSplitModule(ItemTest):
|
||||
|
||||
# There is a test point below (test_create_groups) that purposefully wants the group IDs
|
||||
# of the 2 partitions to overlap (which is not something that normally happens).
|
||||
self.second_user_partition_group_1 = Group(unicode(MINIMUM_STATIC_PARTITION_ID + 1), 'Group 1')
|
||||
self.second_user_partition_group_2 = Group(unicode(MINIMUM_STATIC_PARTITION_ID + 2), 'Group 2')
|
||||
self.second_user_partition_group_3 = Group(unicode(MINIMUM_STATIC_PARTITION_ID + 3), 'Group 3')
|
||||
self.second_user_partition_group_1 = Group(six.text_type(MINIMUM_STATIC_PARTITION_ID + 1), 'Group 1')
|
||||
self.second_user_partition_group_2 = Group(six.text_type(MINIMUM_STATIC_PARTITION_ID + 2), 'Group 2')
|
||||
self.second_user_partition_group_3 = Group(six.text_type(MINIMUM_STATIC_PARTITION_ID + 3), 'Group 3')
|
||||
self.second_user_partition = UserPartition(
|
||||
MINIMUM_STATIC_PARTITION_ID + 10, 'second_partition', 'Second Partition',
|
||||
[
|
||||
@@ -1989,8 +2001,8 @@ class TestEditSplitModule(ItemTest):
|
||||
vertical_1 = self.get_item_from_modulestore(split_test.children[1], verify_is_draft=True)
|
||||
self.assertEqual("vertical", vertical_0.category)
|
||||
self.assertEqual("vertical", vertical_1.category)
|
||||
self.assertEqual("Group ID " + unicode(MINIMUM_STATIC_PARTITION_ID + 1), vertical_0.display_name)
|
||||
self.assertEqual("Group ID " + unicode(MINIMUM_STATIC_PARTITION_ID + 2), vertical_1.display_name)
|
||||
self.assertEqual("Group ID " + six.text_type(MINIMUM_STATIC_PARTITION_ID + 1), vertical_0.display_name)
|
||||
self.assertEqual("Group ID " + six.text_type(MINIMUM_STATIC_PARTITION_ID + 2), vertical_1.display_name)
|
||||
|
||||
# Verify that the group_id_to_child mapping is correct.
|
||||
self.assertEqual(2, len(split_test.group_id_to_child))
|
||||
@@ -2664,7 +2676,7 @@ class TestXBlockInfo(ItemTest):
|
||||
Validate that the xblock info is correct for the test course.
|
||||
"""
|
||||
self.assertEqual(xblock_info['category'], 'course')
|
||||
self.assertEqual(xblock_info['id'], unicode(self.course.location))
|
||||
self.assertEqual(xblock_info['id'], six.text_type(self.course.location))
|
||||
self.assertEqual(xblock_info['display_name'], self.course.display_name)
|
||||
self.assertTrue(xblock_info['published'])
|
||||
self.assertFalse(xblock_info['highlights_enabled_for_messaging'])
|
||||
@@ -2677,7 +2689,7 @@ class TestXBlockInfo(ItemTest):
|
||||
Validate that the xblock info is correct for the test chapter.
|
||||
"""
|
||||
self.assertEqual(xblock_info['category'], 'chapter')
|
||||
self.assertEqual(xblock_info['id'], unicode(self.chapter.location))
|
||||
self.assertEqual(xblock_info['id'], six.text_type(self.chapter.location))
|
||||
self.assertEqual(xblock_info['display_name'], 'Week 1')
|
||||
self.assertTrue(xblock_info['published'])
|
||||
self.assertIsNone(xblock_info.get('edited_by', None))
|
||||
@@ -2697,7 +2709,7 @@ class TestXBlockInfo(ItemTest):
|
||||
Validate that the xblock info is correct for the test sequential.
|
||||
"""
|
||||
self.assertEqual(xblock_info['category'], 'sequential')
|
||||
self.assertEqual(xblock_info['id'], unicode(self.sequential.location))
|
||||
self.assertEqual(xblock_info['id'], six.text_type(self.sequential.location))
|
||||
self.assertEqual(xblock_info['display_name'], 'Lesson 1')
|
||||
self.assertTrue(xblock_info['published'])
|
||||
self.assertIsNone(xblock_info.get('edited_by', None))
|
||||
@@ -2710,7 +2722,7 @@ class TestXBlockInfo(ItemTest):
|
||||
Validate that the xblock info is correct for the test vertical.
|
||||
"""
|
||||
self.assertEqual(xblock_info['category'], 'vertical')
|
||||
self.assertEqual(xblock_info['id'], unicode(self.vertical.location))
|
||||
self.assertEqual(xblock_info['id'], six.text_type(self.vertical.location))
|
||||
self.assertEqual(xblock_info['display_name'], 'Unit 1')
|
||||
self.assertTrue(xblock_info['published'])
|
||||
self.assertEqual(xblock_info['edited_by'], 'testuser')
|
||||
@@ -2732,7 +2744,7 @@ class TestXBlockInfo(ItemTest):
|
||||
Validate that the xblock info is correct for the test component.
|
||||
"""
|
||||
self.assertEqual(xblock_info['category'], 'video')
|
||||
self.assertEqual(xblock_info['id'], unicode(self.video.location))
|
||||
self.assertEqual(xblock_info['id'], six.text_type(self.video.location))
|
||||
self.assertEqual(xblock_info['display_name'], 'My Video')
|
||||
self.assertTrue(xblock_info['published'])
|
||||
self.assertIsNone(xblock_info.get('edited_by', None))
|
||||
@@ -2849,7 +2861,7 @@ class TestLibraryXBlockInfo(ModuleStoreTestCase):
|
||||
ancestors = xblock_info['ancestor_info']['ancestors']
|
||||
self.assertEqual(len(ancestors), 2)
|
||||
self.assertEqual(ancestors[0]['category'], 'vertical')
|
||||
self.assertEqual(ancestors[0]['id'], unicode(self.vertical.location))
|
||||
self.assertEqual(ancestors[0]['id'], six.text_type(self.vertical.location))
|
||||
self.assertEqual(ancestors[1]['category'], 'library')
|
||||
|
||||
def validate_component_xblock_info(self, xblock_info, original_block):
|
||||
@@ -2857,7 +2869,7 @@ class TestLibraryXBlockInfo(ModuleStoreTestCase):
|
||||
Validate that the xblock info is correct for the test component.
|
||||
"""
|
||||
self.assertEqual(xblock_info['category'], original_block.category)
|
||||
self.assertEqual(xblock_info['id'], unicode(original_block.location))
|
||||
self.assertEqual(xblock_info['id'], six.text_type(original_block.location))
|
||||
self.assertEqual(xblock_info['display_name'], original_block.display_name)
|
||||
self.assertIsNone(xblock_info.get('has_changes', None))
|
||||
self.assertIsNone(xblock_info.get('published', None))
|
||||
|
||||
@@ -3,12 +3,15 @@ Unit tests for contentstore.views.library
|
||||
|
||||
More important high-level tests are in contentstore/tests/test_libraries.py
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
from django.conf import settings
|
||||
from mock import patch
|
||||
from opaque_keys.edx.locator import CourseKey, LibraryLocator
|
||||
from six import binary_type, text_type
|
||||
from six.moves import range
|
||||
|
||||
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase, parse_json
|
||||
from contentstore.utils import reverse_course_url, reverse_library_url
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
"""Tests covering the Organizations listing on the Studio home."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
|
||||
from django.urls import reverse
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from mock import patch
|
||||
|
||||
from student.tests.factories import UserFactory
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Tests for items views."""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import copy
|
||||
import json
|
||||
import tempfile
|
||||
@@ -8,6 +10,7 @@ from codecs import BOM_UTF8
|
||||
from uuid import uuid4
|
||||
|
||||
import ddt
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
@@ -26,7 +29,7 @@ from xmodule.video_module.transcripts_utils import (
|
||||
GetTranscriptsFromYouTubeException,
|
||||
Transcript,
|
||||
get_video_transcript_content,
|
||||
remove_subs_from_store,
|
||||
remove_subs_from_store
|
||||
)
|
||||
|
||||
TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE)
|
||||
@@ -84,7 +87,7 @@ class BaseTranscripts(CourseTestCase):
|
||||
|
||||
# Add video module
|
||||
data = {
|
||||
'parent_locator': unicode(self.course.location),
|
||||
'parent_locator': six.text_type(self.course.location),
|
||||
'category': 'video',
|
||||
'type': 'video'
|
||||
}
|
||||
@@ -125,7 +128,7 @@ class BaseTranscripts(CourseTestCase):
|
||||
Setup non video module for tests.
|
||||
"""
|
||||
data = {
|
||||
'parent_locator': unicode(self.course.location),
|
||||
'parent_locator': six.text_type(self.course.location),
|
||||
'category': 'non_video',
|
||||
'type': 'non_video'
|
||||
}
|
||||
@@ -172,7 +175,7 @@ class TestUploadTranscripts(BaseTranscripts):
|
||||
'client_video_id': u'Test Video',
|
||||
'duration': 0,
|
||||
'encoded_videos': [],
|
||||
'courses': [unicode(self.course.id)]
|
||||
'courses': [six.text_type(self.course.id)]
|
||||
})
|
||||
|
||||
# Add clean up handler
|
||||
@@ -399,7 +402,7 @@ class TestChooseTranscripts(BaseTranscripts):
|
||||
'client_video_id': u'Test Video',
|
||||
'duration': 0,
|
||||
'encoded_videos': [],
|
||||
'courses': [unicode(self.course.id)]
|
||||
'courses': [six.text_type(self.course.id)]
|
||||
})
|
||||
|
||||
def choose_transcript(self, locator, chosen_html5_id):
|
||||
@@ -408,7 +411,7 @@ class TestChooseTranscripts(BaseTranscripts):
|
||||
"""
|
||||
payload = {}
|
||||
if locator:
|
||||
payload.update({'locator': unicode(locator)})
|
||||
payload.update({'locator': six.text_type(locator)})
|
||||
|
||||
if chosen_html5_id:
|
||||
payload.update({'html5_id': chosen_html5_id})
|
||||
@@ -519,7 +522,7 @@ class TestRenameTranscripts(BaseTranscripts):
|
||||
'client_video_id': u'Test Video',
|
||||
'duration': 0,
|
||||
'encoded_videos': [],
|
||||
'courses': [unicode(self.course.id)]
|
||||
'courses': [six.text_type(self.course.id)]
|
||||
})
|
||||
|
||||
def rename_transcript(self, locator):
|
||||
@@ -528,7 +531,7 @@ class TestRenameTranscripts(BaseTranscripts):
|
||||
"""
|
||||
payload = {}
|
||||
if locator:
|
||||
payload.update({'locator': unicode(locator)})
|
||||
payload.update({'locator': six.text_type(locator)})
|
||||
|
||||
rename_transcript_url = reverse('rename_transcripts')
|
||||
response = self.client.get(rename_transcript_url, {'data': json.dumps(payload)})
|
||||
@@ -637,7 +640,7 @@ class TestReplaceTranscripts(BaseTranscripts):
|
||||
'client_video_id': u'Test Video',
|
||||
'duration': 0,
|
||||
'encoded_videos': [],
|
||||
'courses': [unicode(self.course.id)]
|
||||
'courses': [six.text_type(self.course.id)]
|
||||
})
|
||||
|
||||
def replace_transcript(self, locator, youtube_id):
|
||||
@@ -646,7 +649,7 @@ class TestReplaceTranscripts(BaseTranscripts):
|
||||
"""
|
||||
payload = {}
|
||||
if locator:
|
||||
payload.update({'locator': unicode(locator)})
|
||||
payload.update({'locator': six.text_type(locator)})
|
||||
|
||||
if youtube_id:
|
||||
payload.update({
|
||||
@@ -775,7 +778,7 @@ class TestDownloadTranscripts(BaseTranscripts):
|
||||
"""
|
||||
payload = {}
|
||||
if locator:
|
||||
payload.update({'locator': unicode(locator)})
|
||||
payload.update({'locator': six.text_type(locator)})
|
||||
|
||||
download_transcript_url = reverse('download_transcripts')
|
||||
response = self.client.get(download_transcript_url, payload)
|
||||
@@ -865,7 +868,7 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
self.save_subs_to_store(subs, subs_id)
|
||||
|
||||
data = {
|
||||
'locator': unicode(self.video_usage_key),
|
||||
'locator': six.text_type(self.video_usage_key),
|
||||
'videos': [{
|
||||
'type': 'html5',
|
||||
'video': subs_id,
|
||||
@@ -883,9 +886,9 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
u'is_youtube_mode': False,
|
||||
u'youtube_server': False,
|
||||
u'command': u'found',
|
||||
u'current_item_subs': unicode(subs_id),
|
||||
u'current_item_subs': six.text_type(subs_id),
|
||||
u'youtube_diff': True,
|
||||
u'html5_local': [unicode(subs_id)],
|
||||
u'html5_local': [six.text_type(subs_id)],
|
||||
u'html5_equal': False,
|
||||
}
|
||||
)
|
||||
@@ -908,7 +911,7 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
self.save_subs_to_store(subs, 'JMD_ifUUfsU')
|
||||
link = reverse('check_transcripts')
|
||||
data = {
|
||||
'locator': unicode(self.video_usage_key),
|
||||
'locator': six.text_type(self.video_usage_key),
|
||||
'videos': [{
|
||||
'type': 'youtube',
|
||||
'video': 'JMD_ifUUfsU',
|
||||
@@ -954,7 +957,7 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
self.save_subs_to_store(subs, 'good_id_2')
|
||||
link = reverse('check_transcripts')
|
||||
data = {
|
||||
'locator': unicode(self.video_usage_key),
|
||||
'locator': six.text_type(self.video_usage_key),
|
||||
'videos': [{
|
||||
'type': 'youtube',
|
||||
'video': 'good_id_2',
|
||||
@@ -1030,7 +1033,7 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
def test_fail_for_non_video_module(self):
|
||||
# Not video module: setup
|
||||
data = {
|
||||
'parent_locator': unicode(self.course.location),
|
||||
'parent_locator': six.text_type(self.course.location),
|
||||
'category': 'not_video',
|
||||
'type': 'not_video'
|
||||
}
|
||||
@@ -1059,7 +1062,7 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
self.save_subs_to_store(subs, subs_id)
|
||||
|
||||
data = {
|
||||
'locator': unicode(usage_key),
|
||||
'locator': six.text_type(usage_key),
|
||||
'videos': [{
|
||||
'type': '',
|
||||
'video': '',
|
||||
@@ -1097,7 +1100,7 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
|
||||
# Make request to check transcript view
|
||||
data = {
|
||||
'locator': unicode(self.video_usage_key),
|
||||
'locator': six.text_type(self.video_usage_key),
|
||||
'videos': [{
|
||||
'type': 'html5',
|
||||
'video': "",
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Unit tests for the unit page.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from contentstore.views.tests.utils import StudioPageTestCase
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.factories import ItemFactory
|
||||
|
||||
@@ -2,48 +2,52 @@
|
||||
"""
|
||||
Unit tests for video-related REST APIs.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import csv
|
||||
import json
|
||||
import re
|
||||
from contextlib import contextmanager
|
||||
from datetime import datetime
|
||||
from functools import wraps
|
||||
from StringIO import StringIO
|
||||
from contextlib import contextmanager
|
||||
|
||||
import dateutil.parser
|
||||
import ddt
|
||||
import pytz
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from edxval.api import (
|
||||
create_or_update_transcript_preferences,
|
||||
create_or_update_video_transcript,
|
||||
create_profile,
|
||||
create_video,
|
||||
get_video_info,
|
||||
get_course_video_image_url,
|
||||
create_or_update_video_transcript
|
||||
get_transcript_preferences,
|
||||
get_video_info
|
||||
)
|
||||
from mock import Mock, patch
|
||||
from waffle.testutils import override_flag
|
||||
|
||||
from contentstore.models import VideoUploadConfig
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
from contentstore.utils import reverse_course_url
|
||||
from contentstore.views.videos import (
|
||||
_get_default_video_image_url,
|
||||
VIDEO_IMAGE_UPLOAD_ENABLED,
|
||||
ENABLE_VIDEO_UPLOAD_PAGINATION,
|
||||
KEY_EXPIRATION_IN_SECONDS,
|
||||
VIDEO_IMAGE_UPLOAD_ENABLED,
|
||||
WAFFLE_SWITCHES,
|
||||
TranscriptProvider
|
||||
StatusDisplayStrings,
|
||||
TranscriptProvider,
|
||||
_get_default_video_image_url,
|
||||
convert_video_status
|
||||
)
|
||||
from contentstore.views.videos import KEY_EXPIRATION_IN_SECONDS, StatusDisplayStrings, convert_video_status
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
from openedx.core.djangoapps.video_pipeline.config.waffle import waffle_flags, DEPRECATE_YOUTUBE
|
||||
from openedx.core.djangoapps.profile_images.tests.helpers import make_image_file
|
||||
from openedx.core.djangoapps.video_pipeline.config.waffle import DEPRECATE_YOUTUBE, waffle_flags
|
||||
from openedx.core.djangoapps.waffle_utils.models import WaffleFlagCourseOverrideModel
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
|
||||
|
||||
from edxval.api import create_or_update_transcript_preferences, get_transcript_preferences
|
||||
from waffle.testutils import override_flag
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
def override_switch(switch, active):
|
||||
@@ -91,7 +95,7 @@ class VideoUploadTestBase(object):
|
||||
self.store.update_item(self.course2, self.user.id)
|
||||
|
||||
# course ids for videos
|
||||
course_ids = [unicode(self.course.id), unicode(self.course2.id)]
|
||||
course_ids = [six.text_type(self.course.id), six.text_type(self.course2.id)]
|
||||
created = datetime.now(pytz.utc)
|
||||
|
||||
self.profiles = ["profile1", "profile2"]
|
||||
@@ -156,7 +160,7 @@ class VideoUploadTestBase(object):
|
||||
"encoded_videos": [],
|
||||
}
|
||||
for status in (
|
||||
StatusDisplayStrings._STATUS_MAP.keys() + # pylint:disable=protected-access
|
||||
list(StatusDisplayStrings._STATUS_MAP.keys()) + # pylint:disable=protected-access
|
||||
["non_existent_status"]
|
||||
)
|
||||
]
|
||||
@@ -519,7 +523,7 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
'client_video_id',
|
||||
file_info['file_name']
|
||||
)
|
||||
mock_key_instance.set_metadata.assert_any_call('course_key', unicode(self.course.id))
|
||||
mock_key_instance.set_metadata.assert_any_call('course_key', six.text_type(self.course.id))
|
||||
mock_key_instance.generate_url.assert_called_once_with(
|
||||
KEY_EXPIRATION_IN_SECONDS,
|
||||
'PUT',
|
||||
@@ -532,7 +536,7 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
self.assertEqual(val_info['client_video_id'], file_info['file_name'])
|
||||
self.assertEqual(val_info['status'], 'upload')
|
||||
self.assertEqual(val_info['duration'], 0)
|
||||
self.assertEqual(val_info['courses'], [{unicode(self.course.id): None}])
|
||||
self.assertEqual(val_info['courses'], [{six.text_type(self.course.id): None}])
|
||||
|
||||
# Ensure response is correct
|
||||
response_file = response_obj['files'][i]
|
||||
@@ -681,7 +685,7 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
self.assertEqual(status, StatusDisplayStrings.get('file_complete'))
|
||||
|
||||
# for all other status, there should not be any conversion
|
||||
statuses = StatusDisplayStrings._STATUS_MAP.keys() # pylint: disable=protected-access
|
||||
statuses = list(StatusDisplayStrings._STATUS_MAP.keys()) # pylint: disable=protected-access
|
||||
statuses.remove('invalid_token')
|
||||
statuses.remove('transcript_ready')
|
||||
for status in statuses:
|
||||
@@ -932,7 +936,7 @@ class VideoImageTestCase(VideoUploadTestBase, CourseTestCase):
|
||||
'extension': '.tiff'
|
||||
},
|
||||
u'This image file type is not supported. Supported file types are {supported_file_formats}.'.format(
|
||||
supported_file_formats=settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS.keys()
|
||||
supported_file_formats=list(settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS.keys())
|
||||
)
|
||||
),
|
||||
# Image file size validation
|
||||
@@ -1287,7 +1291,7 @@ class TranscriptPreferencesTestCase(VideoUploadTestBase, CourseTestCase):
|
||||
Test that transcript handler removes transcript preferences correctly.
|
||||
"""
|
||||
# First add course wide transcript preferences.
|
||||
preferences = create_or_update_transcript_preferences(unicode(self.course.id))
|
||||
preferences = create_or_update_transcript_preferences(six.text_type(self.course.id))
|
||||
|
||||
# Verify transcript preferences exist
|
||||
self.assertIsNotNone(preferences)
|
||||
@@ -1300,7 +1304,7 @@ class TranscriptPreferencesTestCase(VideoUploadTestBase, CourseTestCase):
|
||||
self.assertEqual(response.status_code, 204)
|
||||
|
||||
# Verify transcript preferences no loger exist
|
||||
preferences = get_transcript_preferences(unicode(self.course.id))
|
||||
preferences = get_transcript_preferences(six.text_type(self.course.id))
|
||||
self.assertIsNone(preferences)
|
||||
|
||||
def test_remove_transcript_preferences_not_found(self):
|
||||
|
||||
Reference in New Issue
Block a user