Merge pull request #8013 from edx/merge-release-into-master
Merge release into master
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
Unit tests for cloning a course between the same and different module stores.
|
||||
"""
|
||||
import json
|
||||
from django.conf import settings
|
||||
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from xmodule.modulestore import ModuleStoreEnum, EdxJSONEncoder
|
||||
from contentstore.tests.utils import CourseTestCase
|
||||
@@ -10,6 +12,12 @@ from student.auth import has_course_author_access
|
||||
from course_action_state.models import CourseRerunState
|
||||
from course_action_state.managers import CourseRerunUIStateManager
|
||||
from mock import patch, Mock
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
class CloneCourseTest(CourseTestCase):
|
||||
@@ -46,6 +54,54 @@ class CloneCourseTest(CourseTestCase):
|
||||
self.store.clone_course(split_course3_id, split_course4_id, self.user.id)
|
||||
self.assertCoursesEqual(split_course3_id, split_course4_id)
|
||||
|
||||
def test_space_in_asset_name_for_rerun_course(self):
|
||||
"""
|
||||
Tests check the scenario where one course which has an asset with percentage(%) in its
|
||||
name, it should re-run successfully.
|
||||
"""
|
||||
org = 'edX'
|
||||
course_number = 'CS101'
|
||||
course_run = '2015_Q1'
|
||||
display_name = 'rerun'
|
||||
fields = {'display_name': display_name}
|
||||
course_assets = set([u'subs_Introduction%20To%20New.srt.sjson'], )
|
||||
|
||||
# Create a course using split modulestore
|
||||
course = CourseFactory.create(
|
||||
org=org,
|
||||
number=course_number,
|
||||
run=course_run,
|
||||
display_name=display_name,
|
||||
default_store=ModuleStoreEnum.Type.split
|
||||
)
|
||||
|
||||
# add an asset
|
||||
asset_key = course.id.make_asset_key('asset', 'subs_Introduction%20To%20New.srt.sjson')
|
||||
content = StaticContent(
|
||||
asset_key, 'Dummy assert', 'application/json', 'dummy data',
|
||||
)
|
||||
contentstore().save(content)
|
||||
|
||||
# Get & verify all assets of the course
|
||||
assets, count = contentstore().get_all_content_for_course(course.id)
|
||||
self.assertEqual(count, 1)
|
||||
self.assertEqual(set([asset['asset_key'].block_id for asset in assets]), course_assets)
|
||||
|
||||
# rerun from split into split
|
||||
split_rerun_id = CourseLocator(org=org, course=course_number, run="2012_Q2")
|
||||
CourseRerunState.objects.initiated(course.id, split_rerun_id, self.user, fields['display_name'])
|
||||
result = rerun_course.delay(
|
||||
unicode(course.id),
|
||||
unicode(split_rerun_id),
|
||||
self.user.id,
|
||||
json.dumps(fields, cls=EdxJSONEncoder)
|
||||
)
|
||||
|
||||
# Check if re-run was successful
|
||||
self.assertEqual(result.get(), "succeeded")
|
||||
rerun_state = CourseRerunState.objects.find_first(course_key=split_rerun_id)
|
||||
self.assertEqual(rerun_state.state, CourseRerunUIStateManager.State.SUCCEEDED)
|
||||
|
||||
def test_rerun_course(self):
|
||||
"""
|
||||
Unit tests for :meth: `contentstore.tasks.rerun_course`
|
||||
|
||||
@@ -283,3 +283,23 @@ class ContentStoreImportTest(SignalDisconnectTestMixin, ModuleStoreTestCase):
|
||||
}
|
||||
|
||||
self.assertEqual(remapped_verticals, split_test_module.group_id_to_child)
|
||||
|
||||
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
|
||||
def test_video_components_present_while_import(self, store):
|
||||
"""
|
||||
Test that video components with same edx_video_id are present while re-importing
|
||||
"""
|
||||
with modulestore().default_store(store):
|
||||
module_store = modulestore()
|
||||
course_id = module_store.make_course_key('edX', 'test_import_course', '2012_Fall')
|
||||
|
||||
# Import first time
|
||||
__, __, course = self.load_test_import_course(target_id=course_id, module_store=module_store)
|
||||
|
||||
# Re-import
|
||||
__, __, re_course = self.load_test_import_course(target_id=course.id, module_store=module_store)
|
||||
|
||||
vertical = module_store.get_item(re_course.id.make_usage_key('vertical', 'vertical_test'))
|
||||
|
||||
video = module_store.get_item(vertical.children[1])
|
||||
self.assertEqual(video.display_name, 'default')
|
||||
|
||||
@@ -1259,7 +1259,7 @@ class MetricsMixin(object):
|
||||
)
|
||||
|
||||
|
||||
class DescriptorSystem(ConfigurableFragmentWrapper, Runtime): # pylint: disable=abstract-method
|
||||
class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # pylint: disable=abstract-method
|
||||
"""
|
||||
Base class for :class:`Runtime`s to be used with :class:`XModuleDescriptor`s
|
||||
"""
|
||||
@@ -1505,7 +1505,7 @@ class XMLParsingSystem(DescriptorSystem):
|
||||
setattr(xblock, field.name, field_value)
|
||||
|
||||
|
||||
class ModuleSystem(ConfigurableFragmentWrapper, Runtime): # pylint: disable=abstract-method
|
||||
class ModuleSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # pylint: disable=abstract-method
|
||||
"""
|
||||
This is an abstraction such that x_modules can function independent
|
||||
of the courseware (e.g. import into other types of courseware, LMS,
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
<video display_name="default" youtube_id_0_75="JMD_ifUUfsU" youtube_id_1_0="OEoXaMPEzfM" youtube_id_1_25="AKqURZnYqpk" youtube_id_1_5="DYpADpL7jAY" name="sample_video"/>
|
||||
<video display_name="default" youtube_id_0_75="JMD_ifUUfsU" youtube_id_1_0="OEoXaMPEzfM" youtube_id_1_25="AKqURZnYqpk" youtube_id_1_5="DYpADpL7jAY" name="sample_video" edx_video_id="dummy_edx_video_id">
|
||||
<video_asset client_video_id="dummy.mp4" duration="390.82">
|
||||
<encoded_video bitrate="0" file_size="0" profile="youtube" url="4TjAQhjwPAw"/>
|
||||
</video_asset>
|
||||
</video>
|
||||
|
||||
@@ -611,17 +611,17 @@ def upload_grades_csv(_xmodule_instance_args, _entry_id, course_id, _task_input,
|
||||
task_progress.update_task_state(extra_meta=current_step)
|
||||
task_progress.attempted += 1
|
||||
|
||||
# Now add a log entry after certain intervals to get a hint that task is in progress
|
||||
# Now add a log entry after each student is graded to get a sense
|
||||
# of the task's progress
|
||||
student_counter += 1
|
||||
if student_counter % 1000 == 0:
|
||||
TASK_LOG.info(
|
||||
u'%s, Task type: %s, Current step: %s, Grade calculation in-progress for students: %s/%s',
|
||||
task_info_string,
|
||||
action_name,
|
||||
current_step,
|
||||
student_counter,
|
||||
total_enrolled_students
|
||||
)
|
||||
TASK_LOG.info(
|
||||
u'%s, Task type: %s, Current step: %s, Grade calculation in-progress for students: %s/%s',
|
||||
task_info_string,
|
||||
action_name,
|
||||
current_step,
|
||||
student_counter,
|
||||
total_enrolled_students
|
||||
)
|
||||
|
||||
if gradeset:
|
||||
# We were able to successfully grade this student for this course.
|
||||
|
||||
@@ -38,11 +38,11 @@ git+https://github.com/hmarr/django-debug-toolbar-mongo.git@b0686a76f1ce3532088c
|
||||
-e git+https://github.com/edx/acid-block.git@e46f9cda8a03e121a00c7e347084d142d22ebfb7#egg=acid-xblock
|
||||
-e git+https://github.com/edx/edx-ora2.git@release-2015-05-08T16.15#egg=edx-ora2
|
||||
-e git+https://github.com/edx/edx-submissions.git@e2361932b9bce061a018a31bb3929e9cade80f49#egg=edx-submissions
|
||||
-e git+https://github.com/edx/opaque-keys.git@1254ed4d615a428591850656f39f26509b86d30a#egg=opaque-keys
|
||||
-e git+https://github.com/edx/opaque-keys.git@df0dd602869e498e512659bb4bd243309e30e19a#egg=opaque-keys
|
||||
-e git+https://github.com/edx/ease.git@b67d2928a26fe497826b6ea359b9a3d0371548a7#egg=ease==0.1.3
|
||||
-e git+https://github.com/edx/i18n-tools.git@7b89d5e01c1a7cc5d69d813bd8c6b706a8f75119#egg=i18n-tools
|
||||
-e git+https://github.com/edx/edx-oauth2-provider.git@0.5.1#egg=oauth2-provider
|
||||
-e git+https://github.com/edx/edx-val.git@d6087908aa3dd05ceaa7f56a21284f86c53cb3f0#egg=edx-val
|
||||
-e git+https://github.com/edx/edx-val.git@b1e11c9af3233bc06a17acbb33179f46d43c3b87#egg=edx-val
|
||||
-e git+https://github.com/pmitros/RecommenderXBlock.git@9b07e807c89ba5761827d0387177f71aa57ef056#egg=recommender-xblock
|
||||
-e git+https://github.com/edx/edx-milestones.git@547f2250ee49e73ce8d7ff4e78ecf1b049892510#egg=edx-milestones
|
||||
-e git+https://github.com/edx/edx-search.git@59c7b4a8b61e8f7c4607669ea48e070555cca2fe#egg=edx-search
|
||||
|
||||
Reference in New Issue
Block a user