def test_fetch_video(self): video_value = 'test_video_id' with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id): CourseDetails.update_about_video(self.course, video_value, self.user.id) self.assertEqual(CourseDetails.fetch_youtube_video_id(self.course.id), video_value) video_url = CourseDetails.fetch_video_url(self.course.id) self.assertRegexpMatches(video_url, r'http://.*{}'.format(video_value))
def test_basic(self): course = self.create_course() CourseDetails.update_about_video(course, 'test_youtube_id', self.staff_user.id) with check_mongo_calls(self.expected_mongo_calls): result = self._get_result(course) self.assertDictEqual(result, self.expected_data)
def test_fetch_video(self): video_value = 'test_video_id' with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id): CourseDetails.update_about_video(self.course, video_value, self.user.id) assert CourseDetails.fetch_youtube_video_id(self.course.id) == video_value video_url = CourseDetails.fetch_video_url(self.course.id) self.assertRegex(video_url, fr'http://.*{video_value}')
def test_basic(self): expected_data = { 'course_id': u'edX/toy/2012_Fall', 'name': u'Toy Course', 'number': u'toy', 'org': u'edX', 'short_description': u'A course about toys.', 'media': { 'course_image': { 'uri': u'/c4x/edX/toy/asset/just_a_test.jpg', }, 'course_video': { 'uri': u'http://www.youtube.com/watch?v=test_youtube_id', } }, 'start': u'2015-07-17T12:00:00Z', 'start_type': u'timestamp', 'start_display': u'July 17, 2015', 'end': u'2015-09-19T18:00:00Z', 'enrollment_start': u'2015-06-15T00:00:00Z', 'enrollment_end': u'2015-07-15T00:00:00Z', 'blocks_url': u'http://testserver/api/courses/v1/blocks/?course_id=edX%2Ftoy%2F2012_Fall', 'effort': u'6 hours', } course = self.create_course() CourseDetails.update_about_video(course, 'test_youtube_id', self.staff_user.id) # pylint: disable=no-member result = self._get_result(course) self.assertDictEqual(result, expected_data)