def setUpClass(cls): super().setUpClass() with cls.store.default_store(ModuleStoreEnum.Type.split): cls.course = SampleCourseFactory.create(block_info_tree=[ BlockInfo('empty_chapter', 'chapter', {}, [ BlockInfo('empty_sequential', 'sequential', {}, [ BlockInfo('empty_vertical', 'vertical', {}, []), ]), ]), BlockInfo('full_chapter', 'chapter', {}, [ BlockInfo('full_sequential', 'sequential', {}, [ BlockInfo('full_vertical', 'vertical', {}, [ BlockInfo('html', 'html', {}, []), BlockInfo('sample_video', 'video', {}, []) ]), ]), ]) ])
def setUp(self): super().setUp() block_info_tree = [ BlockInfo('Section', 'chapter', {}, [ BlockInfo('Subsection', 'sequential', {}, [ BlockInfo('Vertical', 'vertical', {}, [ BlockInfo( 'Clip', 'video', { 'edx_video_id': 'edxval1', 'start_time': timedelta(seconds=20), 'end_time': timedelta(seconds=60) }, []), BlockInfo('Video', 'video', {'edx_video_id': 'edxval2'}, []), BlockInfo('Web', 'video', { 'edx_video_id': 'edxval3', 'only_on_web': True }, []), BlockInfo('HTML', 'html', {'data': 'Hello World'}, []), BlockInfo('Problem1', 'problem', {}, []), BlockInfo('Problem2', 'problem', {}, []), ]), ]), ]), ] self.course_key = SampleCourseFactory.create( block_info_tree=block_info_tree).id self.course_usage_key = self.store.make_course_usage_key( self.course_key) self.block_structure = BlockStructureFactory.create_from_modulestore( self.course_usage_key, self.store) self.section_key = self.course_key.make_usage_key('chapter', 'Section') self.subsection_key = self.course_key.make_usage_key( 'sequential', 'Subsection') self.vertical_key = self.course_key.make_usage_key( 'vertical', 'Vertical') self.video_clip_key = self.course_key.make_usage_key('video', 'Clip') self.video_normal_key = self.course_key.make_usage_key( 'video', 'Video') self.video_web_key = self.course_key.make_usage_key('video', 'Web') self.html_key = self.course_key.make_usage_key('html', 'HTML') # Set edxval data create_video({ 'edx_video_id': 'edxval1', 'status': 'uploaded', 'client_video_id': 'Clip Video', 'duration': 200, 'encoded_videos': [], 'courses': [str(self.course_key)], }) create_video({ 'edx_video_id': 'edxval2', 'status': 'uploaded', 'client_video_id': 'Normal Video', 'duration': 30, 'encoded_videos': [], 'courses': [str(self.course_key)], }) create_video({ 'edx_video_id': 'edxval3', 'status': 'uploaded', 'client_video_id': 'Web Video', 'duration': 50, 'encoded_videos': [], 'courses': [str(self.course_key)], })
BlockInfo( 'section1', 'chapter', {}, [ BlockInfo( 'subsection1_1', 'sequential', {"display_name": "Subsection 1.1"}, [ BlockInfo('unit1_1_1', 'vertical', {}, [ BlockInfo( 'html_a', 'html', { "data": ("<p>There is a <strong>CAPA Problem</strong> below.</p>" ), "display_name": "Problem Introduction", }, []), BlockInfo( 'problem_a', 'problem', { "data": ("<problem><multiplechoiceresponse>" " <choicegroup type='MultipleChoice'>" " <choice correct='false'>wrong</choice>" " <choice correct='true'>right</choice>" " </choicegroup>" "</multiplechoiceresponse></problem>") }, []), BlockInfo( 'problem_b', 'problem', { "display_name": "Pointing on a Picture", "max_attempts": None, "data": ("<problem>" "<p>Answer this question by clicking on the image below.</p>" "<imageresponse>" " <imageinput src='/static/edx.svg' width='640' height='400' " " rectangle='(385,98)-(600,337)'/>" "</imageresponse>" "<solution><div class='detailed-solution'><p>Explanation here.</p></div></solution>" "</problem>") }, []), ]), BlockInfo( 'unit1_1_2', 'vertical', {"display_name": "Unit 1.1.2"}, [ BlockInfo( 'html_b', 'html', { "data": ( '<p>' # 'Blockstore video export is 🔥. ' # ^ The HTML XModule strips out emoji (why?), so we can't use this. 'Activate the ωμÎγα 13! ' '<a href="/static/sample_handout.txt">Instructions.</a>' '</p>'), "display_name": "Unicode and URL test", }, []), BlockInfo( 'video_b', 'video', { "transcripts": { "en": "50ce37bf-594a-425c-9892-6407a5083eb3-en.srt" }, "display_name": "YouTube Video", "edx_video_id": "50ce37bf-594a-425c-9892-6407a5083eb3", "youtube_id_1_0": "3_yD_cEKoCk", "data": ('<video>' ' <video_asset client_video_id="video_b_123" duration="0.0" image="">' ' <transcripts>' ' <transcript file_format="srt" language_code="en" provider="Custom"/>' ' </transcripts>' ' </video_asset>' ' <transcript language="en" src="50ce37bf-594a-425c-9892-6407a5083eb3-en.srt"/>' '</video>'), }, []), # We also need to test with a block that doesn't use _any_ XModule mixins: BlockInfo( 'dnd', 'drag-and-drop-v2', { "display_name": "A Drag and Drop Block (Pure XBlock)", }, []), ]), ]), ]),