本文整理汇总了Python中xmodule.video_module.VideoDescriptor.export_to_xml方法的典型用法代码示例。如果您正苦于以下问题:Python VideoDescriptor.export_to_xml方法的具体用法?Python VideoDescriptor.export_to_xml怎么用?Python VideoDescriptor.export_to_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmodule.video_module.VideoDescriptor
的用法示例。
在下文中一共展示了VideoDescriptor.export_to_xml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_export_to_xml
# 需要导入模块: from xmodule.video_module import VideoDescriptor [as 别名]
# 或者: from xmodule.video_module.VideoDescriptor import export_to_xml [as 别名]
def test_export_to_xml(self):
"""Test that we write the correct XML on export."""
module_system = DummySystem(load_error_modules=True)
location = Location(["i4x", "edX", "video", "default", "SampleProblem1"])
desc = VideoDescriptor(module_system, {'location': location})
desc.youtube_id_0_75 = 'izygArpw-Qo'
desc.youtube_id_1_0 = 'p2Q6BrNhdh8'
desc.youtube_id_1_25 = '1EeWXzPdhSA'
desc.youtube_id_1_5 = 'rABDYkeK0x8'
desc.show_captions = False
desc.start_time = 1.0
desc.end_time = 60
desc.track = 'http://www.example.com/track'
desc.html5_sources = ['http://www.example.com/source.mp4', 'http://www.example.com/source.ogg']
xml = desc.export_to_xml(None) # We don't use the `resource_fs` parameter
expected = dedent('''\
<video url_name="SampleProblem1" start_time="0:00:01" youtube="0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8" show_captions="false" end_time="0:01:00">
<source src="http://www.example.com/source.mp4"/>
<source src="http://www.example.com/source.ogg"/>
<track src="http://www.example.com/track"/>
</video>
''')
self.assertEquals(expected, xml)
示例2: test_export_to_xml_empty_parameters
# 需要导入模块: from xmodule.video_module import VideoDescriptor [as 别名]
# 或者: from xmodule.video_module.VideoDescriptor import export_to_xml [as 别名]
def test_export_to_xml_empty_parameters(self):
"""Test XML export with defaults."""
module_system = DummySystem(load_error_modules=True)
location = Location(["i4x", "edX", "video", "default", "SampleProblem1"])
desc = VideoDescriptor(module_system, {'location': location})
xml = desc.export_to_xml(None)
expected = '<video url_name="SampleProblem1"/>\n'
self.assertEquals(expected, xml)