Merge pull request #7405 from edx/shr/bug/PLAT-466-Bad-course-about-page-value-500-error
handle invalid-key exception for split courses
This commit is contained in:
@@ -134,6 +134,10 @@ def course_image_url(course):
|
||||
url += '/' + course.course_image
|
||||
else:
|
||||
url += '/images/course_image.jpg'
|
||||
elif course.course_image == '':
|
||||
# if course_image is empty the url will be blank as location
|
||||
# of the course_image does not exist
|
||||
url = ''
|
||||
else:
|
||||
loc = StaticContent.compute_location(course.id, course.course_image)
|
||||
url = StaticContent.serialize_asset_key_with_slash(loc)
|
||||
|
||||
@@ -529,6 +529,7 @@ class TestTOC(ModuleStoreTestCase):
|
||||
self.assertIn(toc_section, actual)
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class TestHtmlModifiers(ModuleStoreTestCase):
|
||||
"""
|
||||
Tests to verify that standard modifications to the output of XModule/XBlock
|
||||
@@ -639,6 +640,17 @@ class TestHtmlModifiers(ModuleStoreTestCase):
|
||||
self.assertTrue(url.startswith('/static/toy_course_dir/'))
|
||||
self.course.static_asset_path = ""
|
||||
|
||||
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
|
||||
def test_course_image_for_split_course(self, store):
|
||||
"""
|
||||
for split courses if course_image is empty then course_image_url will be blank
|
||||
"""
|
||||
self.course = CourseFactory.create(default_store=store)
|
||||
self.course.course_image = ''
|
||||
|
||||
url = course_image_url(self.course)
|
||||
self.assertEqual('', url)
|
||||
|
||||
def test_get_course_info_section(self):
|
||||
self.course.static_asset_path = "toy_course_dir"
|
||||
get_course_info_section(self.request, self.course, "handouts")
|
||||
|
||||
Reference in New Issue
Block a user