本文整理汇总了Python中openedx.core.djangoapps.models.course_details.CourseDetails.update_about_item方法的典型用法代码示例。如果您正苦于以下问题:Python CourseDetails.update_about_item方法的具体用法?Python CourseDetails.update_about_item怎么用?Python CourseDetails.update_about_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openedx.core.djangoapps.models.course_details.CourseDetails
的用法示例。
在下文中一共展示了CourseDetails.update_about_item方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_updates_values_in_mongo_should_be_updated_in_sql
# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import update_about_item [as 别名]
def test_updates_values_in_mongo_should_be_updated_in_sql(self):
""" Test that a already existing course is correctly updated
by update_course management command.
"""
mongo_course = CourseFactory.create(short_description='test')
# short_description field is required by FUN Course model
CourseDetails.update_about_item(
mongo_course, 'short_description', u"Short description", None)
self.assertFalse(FUNCourse.objects.all().exists())
call_command('update_courses', course_id=unicode(mongo_course.id))
self.assertTrue(u"Short description",
FUNCourse.objects.get(key=mongo_course.id).short_description)
CourseDetails.update_about_item(
mongo_course, 'short_description', u"Short description changed",
None)
call_command('update_courses', course_id=unicode(mongo_course.id))
self.assertEqual(
u"Short description changed",
FUNCourse.objects.get(key=mongo_course.id).short_description)
示例2: test_fetch_about_attribute_error
# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import update_about_item [as 别名]
def test_fetch_about_attribute_error(self):
attribute_name = 'not_an_about_attribute'
with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id):
CourseDetails.update_about_item(self.course, attribute_name, 'test_value', self.user.id)
with self.assertRaises(ValueError):
CourseDetails.fetch_about_attribute(self.course.id, attribute_name)
示例3: test_fetch_about_attribute
# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import update_about_item [as 别名]
def test_fetch_about_attribute(self, attribute_name):
attribute_value = 'test_value'
with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id):
CourseDetails.update_about_item(self.course, attribute_name, attribute_value, self.user.id)
self.assertEqual(CourseDetails.fetch_about_attribute(self.course.id, attribute_name), attribute_value)
示例4: test_fetch_effort
# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import update_about_item [as 别名]
def test_fetch_effort(self):
effort_value = 'test_hours_of_effort'
with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id):
CourseDetails.update_about_item(self.course, 'effort', effort_value, self.user.id)
self.assertEqual(CourseDetails.fetch_effort(self.course.id), effort_value)