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


Python CourseFactory.build方法代码示例

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


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

示例1: test_no_attribute_mapping

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
    def test_no_attribute_mapping(self):
        # Policy files are json, and thus the values aren't passed through 'deserialize_field'
        # Therefor, the string 'null' is passed unchanged to the Float field, which will trigger
        # a ValueError
        with assert_raises(ValueError):
            course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': 'null'}))

            # Trigger the exception by looking at the imported data
            course.days_early_for_beta  # pylint: disable=pointless-statement
开发者ID:luisvasq,项目名称:edx-platform,代码行数:11,代码来源:test_policy.py

示例2: test_video_attr

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
 def test_video_attr(self):
     """
     Test that video's definition_from_xml handles unknown attrs w/o choking
     """
     # Fixes LMS-11491
     root = CourseFactory.build()
     sequence = SequenceFactory.build(parent=root)
     video = XmlImportFactory(
         parent=sequence, tag="video", attribs={"parent_url": "foo", "garbage": "asdlk", "download_video": "true"}
     )
     video_block = self.process_xml(video)
     assert_in("garbage", video_block.xml_attributes)
开发者ID:ahmadiga,项目名称:min_edx,代码行数:14,代码来源:test_inheritance.py

示例3: test_null_string

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
    def test_null_string(self):
        # Test that the string inherited fields are passed through 'deserialize_field',
        # which converts the string "null" to the python value None
        root = CourseFactory.build(days_early_for_beta="null")
        sequence = SequenceFactory.build(parent=root)
        ProblemFactory.build(parent=sequence)

        course = self.process_xml(root)
        assert_equals(None, course.days_early_for_beta)

        sequence = course.get_children()[0]
        assert_equals(None, sequence.days_early_for_beta)

        problem = sequence.get_children()[0]
        assert_equals(None, problem.days_early_for_beta)
开发者ID:1amongus,项目名称:edx-platform,代码行数:17,代码来源:test_inheritance.py

示例4: test_video_attr

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
 def test_video_attr(self):
     """
     Test that video's definition_from_xml handles unknown attrs w/o choking
     """
     # Fixes LMS-11491
     root = CourseFactory.build()
     sequence = SequenceFactory.build(parent=root)
     video = XmlImportFactory(
         parent=sequence,
         tag='video',
         attribs={
             'parent_url': 'foo', 'garbage': 'asdlk',
             'download_video': 'true',
         }
     )
     video_block = self.process_xml(video)
     assert 'garbage' in video_block.xml_attributes
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:19,代码来源:test_inheritance.py

示例5: test_course_policy

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
    def test_course_policy(self):
        course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': None}))
        assert_equals(None, course.days_early_for_beta)

        course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': 9}))
        assert_equals(9, course.days_early_for_beta)
开发者ID:luisvasq,项目名称:edx-platform,代码行数:8,代码来源:test_policy.py

示例6: test_known_attribute

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
 def test_known_attribute(self):
     assert_true(hasattr(CourseDescriptor, 'show_calculator'))
     course = self.process_xml(CourseFactory.build(show_calculator='true'))
     assert_true(course.show_calculator)
     assert_not_in('show_calculator', course.xml_attributes)
开发者ID:bryanlandia,项目名称:edx-platform,代码行数:7,代码来源:test_xml_module.py

示例7: test_unknown_attribute

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
 def test_unknown_attribute(self):
     assert_false(hasattr(CourseDescriptor, 'unknown_attr'))
     course = self.process_xml(CourseFactory.build(unknown_attr='value'))
     assert_false(hasattr(course, 'unknown_attr'))
     assert_equals('value', course.xml_attributes['unknown_attr'])
开发者ID:bryanlandia,项目名称:edx-platform,代码行数:7,代码来源:test_xml_module.py

示例8: test_course_policy

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
    def test_course_policy(self):
        course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': None}))
        assert course.days_early_for_beta is None

        course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': 9}))
        assert course.days_early_for_beta == 9
开发者ID:cmscom,项目名称:edx-platform,代码行数:8,代码来源:test_policy.py

示例9: test_known_attribute

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
 def test_known_attribute(self):
     assert hasattr(CourseDescriptor, 'show_calculator')
     course = self.process_xml(CourseFactory.build(show_calculator='true'))
     assert course.show_calculator
     assert 'show_calculator' not in course.xml_attributes
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:7,代码来源:test_xml_module.py

示例10: test_unknown_attribute

# 需要导入模块: from xmodule.tests.xml.factories import CourseFactory [as 别名]
# 或者: from xmodule.tests.xml.factories.CourseFactory import build [as 别名]
 def test_unknown_attribute(self):
     assert not hasattr(CourseDescriptor, 'unknown_attr')
     course = self.process_xml(CourseFactory.build(unknown_attr='value'))
     assert not hasattr(course, 'unknown_attr')
     assert course.xml_attributes['unknown_attr'] == 'value'
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:7,代码来源:test_xml_module.py


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