diff --git a/cms/djangoapps/contentstore/module_info_model.py b/cms/djangoapps/contentstore/module_info_model.py index bce4b0326c..049f95c221 100644 --- a/cms/djangoapps/contentstore/module_info_model.py +++ b/cms/djangoapps/contentstore/module_info_model.py @@ -1,6 +1,5 @@ from static_replace import replace_static_urls from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule.modulestore import Location def get_module_info(store, location, rewrite_static_links=False): @@ -16,13 +15,7 @@ def get_module_info(store, location, rewrite_static_links=False): data = replace_static_urls( module.data, None, - course_namespace=Location([ - module.location.tag, - module.location.org, - module.location.course, - None, - None - ]) + course_id=module.location.org + '/' + module.location.course + '/REPLACE_WITH_RUN_WHEN_IMPLEMENTED' ) return { diff --git a/common/djangoapps/static_replace/test/test_static_replace.py b/common/djangoapps/static_replace/test/test_static_replace.py index f23610e1bd..b1bc05b895 100644 --- a/common/djangoapps/static_replace/test/test_static_replace.py +++ b/common/djangoapps/static_replace/test/test_static_replace.py @@ -10,7 +10,6 @@ from xmodule.modulestore.xml import XMLModuleStore DATA_DIRECTORY = 'data_dir' COURSE_ID = 'org/course/run' -NAMESPACE = Location('org', 'course', 'run', None, None) STATIC_SOURCE = '"/static/file.png"' @@ -52,18 +51,18 @@ def test_storage_url_not_exists(mock_storage): def test_mongo_filestore(mock_modulestore, mock_static_content): mock_modulestore.return_value = Mock(MongoModuleStore) - mock_static_content.convert_legacy_static_url.return_value = "c4x://mock_url" + mock_static_content.convert_legacy_static_url_with_course_id.return_value = "c4x://mock_url" # No namespace => no change to path assert_equals('"/static/data_dir/file.png"', replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY)) # Namespace => content url assert_equals( - '"' + mock_static_content.convert_legacy_static_url.return_value + '"', - replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY, NAMESPACE) + '"' + mock_static_content.convert_legacy_static_url_with_course_id.return_value + '"', + replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY, course_id=COURSE_ID) ) - mock_static_content.convert_legacy_static_url.assert_called_once_with('file.png', NAMESPACE) + mock_static_content.convert_legacy_static_url_with_course_id.assert_called_once_with('file.png', COURSE_ID) @patch('static_replace.settings') diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 65da586812..af71e15be7 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -54,7 +54,7 @@ class TestVideo(BaseTestXmodule): expected_context = { 'data_dir': getattr(self, 'data_dir', None), - 'caption_asset_path': '/c4x/MITx/999/asset/subs_', + 'caption_asset_path': '/static/subs/', 'show_captions': 'true', 'display_name': 'A Name', 'end': 3610.0, @@ -104,10 +104,17 @@ class TestVideoNonYouTube(TestVideo): expected_context = { 'data_dir': getattr(self, 'data_dir', None), +<<<<<<< HEAD 'caption_asset_path': '/c4x/MITx/999/asset/subs_', 'show_captions': 'true', 'display_name': 'A Name', 'end': 3610.0, +======= + 'caption_asset_path': '/static/subs/', + 'show_captions': self.item_module.show_captions, + 'display_name': self.item_module.display_name_with_default, + 'end': self.item_module.end_time, +>>>>>>> fix tests 'id': self.item_module.location.html_id(), 'sources': sources, 'start': 3603.0, diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 25475eb36a..f73cfb6e5b 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -50,7 +50,7 @@ def remap_static_url(original_url, course): output_url = replace_static_urls( input_url, getattr(course, 'data_dir', None), - coures_id=course.location.course_id, + course_id=course.location.course_id, ) # strip off the quotes again... return output_url[1:-1]