当前位置: 首页>>代码示例>>Python>>正文


Python CourseDetails.fetch方法代码示例

本文整理汇总了Python中openedx.core.djangoapps.models.course_details.CourseDetails.fetch方法的典型用法代码示例。如果您正苦于以下问题:Python CourseDetails.fetch方法的具体用法?Python CourseDetails.fetch怎么用?Python CourseDetails.fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openedx.core.djangoapps.models.course_details.CourseDetails的用法示例。


在下文中一共展示了CourseDetails.fetch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_update_and_fetch

# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import fetch [as 别名]
 def test_update_and_fetch(self):
     SelfPacedConfiguration(enabled=True).save()
     jsondetails = CourseDetails.fetch(self.course.id)
     jsondetails.syllabus = "<a href='foo'>bar</a>"
     # encode - decode to convert date fields and other data which changes form
     with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id):
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).syllabus,
             jsondetails.syllabus, "After set syllabus"
         )
         jsondetails.short_description = "Short Description"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).short_description,
             jsondetails.short_description, "After set short_description"
         )
         jsondetails.overview = "Overview"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).overview,
             jsondetails.overview, "After set overview"
         )
         jsondetails.intro_video = "intro_video"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).intro_video,
             jsondetails.intro_video, "After set intro_video"
         )
         jsondetails.effort = "effort"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).effort,
             jsondetails.effort, "After set effort"
         )
         jsondetails.self_paced = True
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).self_paced,
             jsondetails.self_paced
         )
         jsondetails.start_date = datetime.datetime(2010, 10, 1, 0, tzinfo=UTC())
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).start_date,
             jsondetails.start_date
         )
         jsondetails.end_date = datetime.datetime(2011, 10, 1, 0, tzinfo=UTC())
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).end_date,
             jsondetails.end_date
         )
         jsondetails.course_image_name = "an_image.jpg"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).course_image_name,
             jsondetails.course_image_name
         )
         jsondetails.language = "hr"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).language,
             jsondetails.language
         )
开发者ID:28554010,项目名称:edx-platform,代码行数:57,代码来源:test_course_details.py

示例2: test_toggle_pacing_during_course_run

# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import fetch [as 别名]
    def test_toggle_pacing_during_course_run(self):
        SelfPacedConfiguration(enabled=True).save()
        self.course.start = datetime.datetime.now()
        self.store.update_item(self.course, self.user.id)

        details = CourseDetails.fetch(self.course.id)
        with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id):
            updated_details = CourseDetails.update_from_json(
                self.course.id, dict(details.__dict__, self_paced=True), self.user
            )
        self.assertFalse(updated_details.self_paced)
开发者ID:zhenzhai,项目名称:edx-platform,代码行数:13,代码来源:test_course_details.py

示例3: test_virgin_fetch

# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import fetch [as 别名]
 def test_virgin_fetch(self):
     details = CourseDetails.fetch(self.course.id)
     self.assertEqual(details.org, self.course.location.org, "Org not copied into")
     self.assertEqual(details.course_id, self.course.location.course, "Course_id not copied into")
     self.assertEqual(details.run, self.course.location.name, "Course name not copied into")
     self.assertEqual(details.course_image_name, self.course.course_image)
     self.assertIsNotNone(details.start_date.tzinfo)
     self.assertIsNone(details.end_date, "end date somehow initialized " + str(details.end_date))
     self.assertIsNone(
         details.enrollment_start, "enrollment_start date somehow initialized " + str(details.enrollment_start)
     )
     self.assertIsNone(
         details.enrollment_end, "enrollment_end date somehow initialized " + str(details.enrollment_end)
     )
     self.assertIsNone(details.syllabus, "syllabus somehow initialized" + str(details.syllabus))
     self.assertIsNone(details.intro_video, "intro_video somehow initialized" + str(details.intro_video))
     self.assertIsNone(details.effort, "effort somehow initialized" + str(details.effort))
     self.assertIsNone(details.language, "language somehow initialized" + str(details.language))
     self.assertFalse(details.self_paced)
开发者ID:28554010,项目名称:edx-platform,代码行数:21,代码来源:test_course_details.py

示例4: test_update_and_fetch

# 需要导入模块: from openedx.core.djangoapps.models.course_details import CourseDetails [as 别名]
# 或者: from openedx.core.djangoapps.models.course_details.CourseDetails import fetch [as 别名]
 def test_update_and_fetch(self):
     jsondetails = CourseDetails.fetch(self.course.id)
     jsondetails.syllabus = "<a href='foo'>bar</a>"
     # encode - decode to convert date fields and other data which changes form
     with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id):
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).syllabus,
             jsondetails.syllabus, "After set syllabus"
         )
         jsondetails.short_description = "Short Description"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).short_description,
             jsondetails.short_description, "After set short_description"
         )
         jsondetails.overview = "Overview"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).overview,
             jsondetails.overview, "After set overview"
         )
         jsondetails.intro_video = "intro_video"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).intro_video,
             jsondetails.intro_video, "After set intro_video"
         )
         jsondetails.effort = "effort"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).effort,
             jsondetails.effort, "After set effort"
         )
         jsondetails.self_paced = True
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).self_paced,
             jsondetails.self_paced
         )
         jsondetails.start_date = datetime.datetime(2010, 10, 1, 0, tzinfo=UTC)
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).start_date,
             jsondetails.start_date
         )
         jsondetails.end_date = datetime.datetime(2011, 10, 1, 0, tzinfo=UTC)
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).end_date,
             jsondetails.end_date
         )
         jsondetails.certificate_available_date = datetime.datetime(2010, 10, 1, 0, tzinfo=UTC)
         self.assertEqual(
             CourseDetails.update_from_json(
                 self.course.id, jsondetails.__dict__, self.user
             ).certificate_available_date,
             jsondetails.certificate_available_date
         )
         jsondetails.course_image_name = "an_image.jpg"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).course_image_name,
             jsondetails.course_image_name
         )
         jsondetails.banner_image_name = "an_image.jpg"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).banner_image_name,
             jsondetails.banner_image_name
         )
         jsondetails.video_thumbnail_image_name = "an_image.jpg"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).video_thumbnail_image_name,
             jsondetails.video_thumbnail_image_name
         )
         jsondetails.language = "hr"
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).language,
             jsondetails.language
         )
         jsondetails.learning_info = ["test", "test"]
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).learning_info,
             jsondetails.learning_info
         )
         jsondetails.instructor_info = {
             "instructors": [
                 {
                     "name": "test",
                     "title": "test",
                     "organization": "test",
                     "image": "test",
                     "bio": "test"
                 }
             ]
         }
         self.assertEqual(
             CourseDetails.update_from_json(self.course.id, jsondetails.__dict__, self.user).instructor_info,
             jsondetails.instructor_info
         )
开发者ID:TeachAtTUM,项目名称:edx-platform,代码行数:93,代码来源:test_course_details.py


注:本文中的openedx.core.djangoapps.models.course_details.CourseDetails.fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。