Merge branch 'master' of github.com:edx/edx-platform into feature/ichuang/import-with-no-static

Conflicts:
	lms/djangoapps/courseware/tests/test_module_render.py
This commit is contained in:
ichuang
2013-08-20 23:40:09 -04:00
66 changed files with 1865 additions and 492 deletions

View File

@@ -281,10 +281,11 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self.course = CourseFactory.create()
self.content_string = '<p>This is the content<p>'
self.rewrite_link = '<a href="/static/foo/content">Test rewrite</a>'
self.rewrite_bad_link = '<img src="/static//file.jpg" />'
self.course_link = '<a href="/course/bar/content">Test course rewrite</a>'
self.descriptor = ItemFactory.create(
category='html',
data=self.content_string + self.rewrite_link + self.course_link
data=self.content_string + self.rewrite_link + self.rewrite_bad_link + self.course_link
)
self.location = self.descriptor.location
self.model_data_cache = ModelDataCache.cache_for_descriptor_descendents(
@@ -337,6 +338,25 @@ class TestHtmlModifiers(ModuleStoreTestCase):
result_fragment.content
)
def test_static_badlink_rewrite(self):
module = render.get_module(
self.user,
self.request,
self.location,
self.model_data_cache,
self.course.id,
)
result_fragment = module.runtime.render(module, None, 'student_view')
self.assertIn(
'/c4x/{org}/{course}/asset/_file.jpg'.format(
org=self.course.location.org,
course=self.course.location.course,
),
result_fragment.content
)
def test_static_asset_path_use(self):
'''
when a course is loaded with do_import_static=False (see xml_importer.py), then
@@ -371,6 +391,7 @@ class TestHtmlModifiers(ModuleStoreTestCase):
# TODO: check handouts output...right now test course seems to have no such content
# at least this makes sure get_course_info_section returns without exception
def test_course_link_rewrite(self):
module = render.get_module(
self.user,