• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tests.get_test_descriptor_system函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中xmodule.tests.get_test_descriptor_system函数的典型用法代码示例。如果您正苦于以下问题:Python get_test_descriptor_system函数的具体用法?Python get_test_descriptor_system怎么用?Python get_test_descriptor_system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _create_peer_grading_descriptor_with_linked_problem

    def _create_peer_grading_descriptor_with_linked_problem(self):
        # Initialize the peer grading module.
        system = get_test_descriptor_system()

        return system.construct_xblock_from_class(
            PeerGradingDescriptor, field_data=self.field_data, scope_ids=self.scope_ids
        )
开发者ID:fjardon,项目名称:edx-platform,代码行数:7,代码来源:test_peer_grading.py


示例2: setUp

    def setUp(self):
        super(TabsEditingDescriptorTestCase, self).setUp()
        system = get_test_descriptor_system()
        system.render_template = Mock(return_value="<div>Test Template HTML</div>")
        self.tabs = [
            {
                'name': "Test_css",
                'template': "tabs/codemirror-edit.html",
                'current': True,
                'css': {
                    'scss': [resource_string(__name__,
                    '../../test_files/test_tabseditingdescriptor.scss')],
                    'css': [resource_string(__name__,
                    '../../test_files/test_tabseditingdescriptor.css')]
                }
            },
            {
                'name': "Subtitles",
                'template': "video/subtitles.html",
            },
            {
                'name': "Settings",
                'template': "tabs/video-metadata-edit-tab.html"
            }
        ]

        TabsEditingDescriptor.tabs = self.tabs
        self.descriptor = system.construct_xblock_from_class(
            TabsEditingDescriptor,
            field_data=DictFieldData({}),
            scope_ids=ScopeIds(None, None, None, None),
        )
开发者ID:AzizYosofi,项目名称:edx-platform,代码行数:32,代码来源:test_editing_module.py


示例3: setUp

 def setUp(self):
     system = get_test_descriptor_system()
     self.descriptor = system.construct_xblock_from_class(
         VideoDescriptor,
         field_data=DictFieldData({}),
         scope_ids=ScopeIds(None, None, None, None),
     )
开发者ID:GSeralin,项目名称:edx-platform,代码行数:7,代码来源:test_video.py


示例4: get_xml_editable_fields

 def get_xml_editable_fields(self, field_data):
     runtime = get_test_descriptor_system()
     return runtime.construct_xblock_from_class(
         XmlDescriptor,
         scope_ids=Mock(),
         field_data=field_data,
     ).editable_metadata_fields
开发者ID:bryanlandia,项目名称:edx-platform,代码行数:7,代码来源:test_xml_module.py


示例5: leaf_descriptor

 def leaf_descriptor(self, descriptor_cls):
     location = "i4x://org/course/category/name"
     runtime = get_test_descriptor_system()
     runtime.render_template = lambda *args, **kwargs: u"{!r}, {!r}".format(args, kwargs)
     return runtime.construct_xblock_from_class(
         descriptor_cls, ScopeIds(None, descriptor_cls.__name__, location, location), DictFieldData({})
     )
开发者ID:rjsheperd,项目名称:edx-platform,代码行数:7,代码来源:test_xblock_wrappers.py


示例6: create

    def create(system, source_is_error_module=False):
        """
        return a dict of modules: the conditional with a single source and a single child.
        Keys are 'cond_module', 'source_module', and 'child_module'.

        if the source_is_error_module flag is set, create a real ErrorModule for the source.
        """
        descriptor_system = get_test_descriptor_system()

        # construct source descriptor and module:
        source_location = Location(["i4x", "edX", "conditional_test", "problem", "SampleProblem"])
        if source_is_error_module:
            # Make an error descriptor and module
            source_descriptor = NonStaffErrorDescriptor.from_xml(
                'some random xml data',
                system,
                org=source_location.org,
                course=source_location.course,
                error_msg='random error message'
            )
        else:
            source_descriptor = Mock()
            source_descriptor.location = source_location

        source_descriptor.runtime = descriptor_system
        source_descriptor.render = lambda view, context=None: descriptor_system.render(source_descriptor, view, context)

        # construct other descriptors:
        child_descriptor = Mock()
        child_descriptor._xmodule.student_view.return_value.content = u'<p>This is a secret</p>'
        child_descriptor.student_view = child_descriptor._xmodule.student_view
        child_descriptor.displayable_items.return_value = [child_descriptor]
        child_descriptor.runtime = descriptor_system
        child_descriptor.xmodule_runtime = get_test_system()
        child_descriptor.render = lambda view, context=None: descriptor_system.render(child_descriptor, view, context)

        descriptor_system.load_item = {'child': child_descriptor, 'source': source_descriptor}.get

        # construct conditional module:
        cond_location = Location(["i4x", "edX", "conditional_test", "conditional", "SampleConditional"])
        field_data = DictFieldData({
            'data': '<conditional/>',
            'xml_attributes': {'attempted': 'true'},
            'children': ['child'],
        })

        cond_descriptor = ConditionalDescriptor(
            descriptor_system,
            field_data,
            ScopeIds(None, None, cond_location, cond_location)
        )
        cond_descriptor.xmodule_runtime = system
        system.get_module = lambda desc: desc
        cond_descriptor.get_required_module_descriptors = Mock(return_value=[source_descriptor])

        # return dict:
        return {'cond_module': cond_descriptor,
                'source_module': source_descriptor,
                'child_module': child_descriptor}
开发者ID:Codeyelp,项目名称:edx-platform,代码行数:59,代码来源:test_conditional.py


示例7: setUp

 def setUp(self):
     system = get_test_descriptor_system()
     course_key = SlashSeparatedCourseKey("org", "course", "run")
     usage_key = course_key.make_usage_key("video", "name")
     self.descriptor = system.construct_xblock_from_class(
         VideoDescriptor, scope_ids=ScopeIds(None, None, usage_key, usage_key), field_data=DictFieldData({})
     )
     self.descriptor.runtime.handler_url = MagicMock()
开发者ID:reroes,项目名称:edx-platform,代码行数:8,代码来源:test_video_mongo.py


示例8: setUp

 def setUp(self):
     system = get_test_descriptor_system()
     location = Location('org', 'course', 'run', 'video', 'name', None)
     self.descriptor = system.construct_xblock_from_class(
         VideoDescriptor,
         scope_ids=ScopeIds(None, None, location, location),
         field_data=DictFieldData({}),
     )
开发者ID:jianchang653,项目名称:edx-platform,代码行数:8,代码来源:test_video.py


示例9: setUp

 def setUp(self):
     self.system = get_test_descriptor_system()
     self.all_blocks = {}
     self.system.get_block = self.all_blocks.get
     self.field_data = InheritingFieldData(
         inheritable_names=['inherited'],
         kvs=DictKeyValueStore({}),
     )
开发者ID:smartdec,项目名称:edx-platform,代码行数:8,代码来源:test_xml_module.py


示例10: leaf_descriptor

 def leaf_descriptor(self, descriptor_cls):
     location = 'i4x://org/course/category/name'
     runtime = get_test_descriptor_system()
     return runtime.construct_xblock_from_class(
         descriptor_cls,
         ScopeIds(None, descriptor_cls.__name__, location, location),
         DictFieldData({}),
     )
开发者ID:6thfdwp,项目名称:edx-platform,代码行数:8,代码来源:test_xblock_wrappers.py


示例11: create

    def create(system, source_is_error_module=False):
        """
        return a dict of modules: the conditional with a single source and a single child.
        Keys are 'cond_module', 'source_module', and 'child_module'.

        if the source_is_error_module flag is set, create a real ErrorModule for the source.
        """
        descriptor_system = get_test_descriptor_system()

        # construct source descriptor and module:
        source_location = Location("edX", "conditional_test", "test_run", "problem", "SampleProblem", None)
        if source_is_error_module:
            # Make an error descriptor and module
            source_descriptor = NonStaffErrorDescriptor.from_xml(
                "some random xml data",
                system,
                id_generator=CourseLocationManager(source_location.course_key),
                error_msg="random error message",
            )
        else:
            source_descriptor = Mock(name="source_descriptor")
            source_descriptor.location = source_location

        source_descriptor.runtime = descriptor_system
        source_descriptor.render = lambda view, context=None: descriptor_system.render(source_descriptor, view, context)

        # construct other descriptors:
        child_descriptor = Mock(name="child_descriptor")
        child_descriptor._xmodule.student_view.return_value.content = u"<p>This is a secret</p>"
        child_descriptor.student_view = child_descriptor._xmodule.student_view
        child_descriptor.displayable_items.return_value = [child_descriptor]
        child_descriptor.runtime = descriptor_system
        child_descriptor.xmodule_runtime = get_test_system()
        child_descriptor.render = lambda view, context=None: descriptor_system.render(child_descriptor, view, context)
        child_descriptor.location = source_location.replace(category="html", name="child")

        descriptor_system.load_item = {
            child_descriptor.location: child_descriptor,
            source_location: source_descriptor,
        }.get

        system.descriptor_runtime = descriptor_system

        # construct conditional module:
        cond_location = Location("edX", "conditional_test", "test_run", "conditional", "SampleConditional", None)
        field_data = DictFieldData(
            {"data": "<conditional/>", "xml_attributes": {"attempted": "true"}, "children": [child_descriptor.location]}
        )

        cond_descriptor = ConditionalDescriptor(
            descriptor_system, field_data, ScopeIds(None, None, cond_location, cond_location)
        )
        cond_descriptor.xmodule_runtime = system
        system.get_module = lambda desc: desc
        cond_descriptor.get_required_module_descriptors = Mock(return_value=[source_descriptor])

        # return dict:
        return {"cond_module": cond_descriptor, "source_module": source_descriptor, "child_module": child_descriptor}
开发者ID:fjardon,项目名称:edx-platform,代码行数:58,代码来源:test_conditional.py


示例12: setUp

 def setUp(self):
     system = get_test_descriptor_system()
     location = Location('i4x://org/course/video/name')
     self.descriptor = system.construct_xblock_from_class(
         VideoDescriptor,
         scope_ids=ScopeIds(None, None, location, location),
         field_data=DictFieldData({}),
     )
     self.descriptor.runtime.handler_url = MagicMock()
开发者ID:Neodemia,项目名称:edx-platform,代码行数:9,代码来源:test_video_mongo.py


示例13: setUp

 def setUp(self):
     super(InheritingFieldDataTest, self).setUp()
     self.dummy_course_key = CourseLocator('test_org', 'test_123', 'test_run')
     self.system = get_test_descriptor_system()
     self.all_blocks = {}
     self.system.get_block = self.all_blocks.get
     self.field_data = InheritingFieldData(
         inheritable_names=['inherited'],
         kvs=DictKeyValueStore({}),
     )
开发者ID:bryanlandia,项目名称:edx-platform,代码行数:10,代码来源:test_xml_module.py


示例14: get_descriptor

    def get_descriptor(self, field_data):
        class TestModuleDescriptor(TestFields, XmlDescriptor):
            @property
            def non_editable_metadata_fields(self):
                non_editable_fields = super(TestModuleDescriptor, self).non_editable_metadata_fields
                non_editable_fields.append(TestModuleDescriptor.due)
                return non_editable_fields

        system = get_test_descriptor_system()
        system.render_template = Mock(return_value="<div>Test Template HTML</div>")
        return system.construct_xblock_from_class(TestModuleDescriptor, field_data=field_data, scope_ids=Mock())
开发者ID:bryanlandia,项目名称:edx-platform,代码行数:11,代码来源:test_xml_module.py


示例15: container_descriptor

 def container_descriptor(self, descriptor_cls):
     location = 'i4x://org/course/category/name'
     runtime = get_test_descriptor_system()
     runtime.render_template = lambda *args, **kwargs: u'{!r}, {!r}'.format(args, kwargs)
     return runtime.construct_xblock_from_class(
         descriptor_cls,
         DictFieldData({
             'children': range(3)
         }),
         ScopeIds(None, descriptor_cls.__name__, location, location)
     )
开发者ID:AzizYosofi,项目名称:edx-platform,代码行数:11,代码来源:test_xblock_wrappers.py


示例16: create

    def create():
        """Method return Video Xmodule instance."""
        location = Location(["i4x", "edX", "video", "default",
                             "SampleProblem1"])
        field_data = {'data': VideoFactory.sample_problem_xml_youtube,
                      'location': location}

        system = get_test_descriptor_system()

        descriptor = VideoDescriptor(system, DictFieldData(field_data), ScopeIds(None, None, None, None))
        descriptor.xmodule_runtime = get_test_system()
        return descriptor
开发者ID:chenkaigithub,项目名称:edx-platform,代码行数:12,代码来源:test_video_xml.py


示例17: instantiate_descriptor

def instantiate_descriptor(**field_data):
    """
    Instantiate descriptor with most properties.
    """
    system = get_test_descriptor_system()
    course_key = SlashSeparatedCourseKey('org', 'course', 'run')
    usage_key = course_key.make_usage_key('video', 'SampleProblem')
    return system.construct_xblock_from_class(
        VideoDescriptor,
        scope_ids=ScopeIds(None, None, usage_key, usage_key),
        field_data=DictFieldData(field_data),
    )
开发者ID:Edraak,项目名称:edx-platform,代码行数:12,代码来源:test_video.py


示例18: container_descriptor

    def container_descriptor(self, descriptor_cls, depth):
        """Return an instance of `descriptor_cls` with `depth` levels of children"""
        location = 'i4x://org/course/category/name'
        runtime = get_test_descriptor_system()

        if depth == 0:
            runtime.load_item.side_effect = lambda x: self.leaf_module(HtmlDescriptor)
        else:
            runtime.load_item.side_effect = lambda x: self.container_module(VerticalDescriptor, depth - 1)

        return runtime.construct_xblock_from_class(
            descriptor_cls,
            ScopeIds(None, descriptor_cls.__name__, location, location),
            DictFieldData({
                'children': range(3)
            }),
        )
开发者ID:6thfdwp,项目名称:edx-platform,代码行数:17,代码来源:test_xblock_wrappers.py


示例19: _build

 def _build(cls, target_class, *args, **kwargs):  # pylint: disable=unused-argument
     """See documentation from :meth:`factory.Factory._build`"""
     return get_test_descriptor_system(*args, **kwargs)
开发者ID:Certific-NET,项目名称:edx-platform,代码行数:3,代码来源:test_xblock_wrappers.py


示例20: create

    def create(system, source_is_error_module=False):
        """
        return a dict of modules: the conditional with a single source and a single child.
        Keys are 'cond_module', 'source_module', and 'child_module'.

        if the source_is_error_module flag is set, create a real ErrorModule for the source.
        """
        descriptor_system = get_test_descriptor_system()

        # construct source descriptor and module:
        source_location = Location("edX", "conditional_test", "test_run", "problem", "SampleProblem", None)
        if source_is_error_module:
            # Make an error descriptor and module
            source_descriptor = NonStaffErrorDescriptor.from_xml(
                'some random xml data',
                system,
                id_generator=CourseLocationManager(source_location.course_key),
                error_msg='random error message'
            )
        else:
            source_descriptor = Mock(name='source_descriptor')
            source_descriptor.location = source_location

        source_descriptor.runtime = descriptor_system
        source_descriptor.render = lambda view, context=None: descriptor_system.render(source_descriptor, view, context)

        # construct other descriptors:
        child_descriptor = Mock(name='child_descriptor')
        child_descriptor._xmodule.student_view.return_value.content = u'<p>This is a secret</p>'
        child_descriptor.student_view = child_descriptor._xmodule.student_view
        child_descriptor.displayable_items.return_value = [child_descriptor]
        child_descriptor.runtime = descriptor_system
        child_descriptor.xmodule_runtime = get_test_system()
        child_descriptor.render = lambda view, context=None: descriptor_system.render(child_descriptor, view, context)
        child_descriptor.location = source_location.replace(category='html', name='child')

        def load_item(usage_id, for_parent=None):  # pylint: disable=unused-argument
            """Test-only implementation of load_item that simply returns static xblocks."""
            return {
                child_descriptor.location: child_descriptor,
                source_location: source_descriptor
            }.get(usage_id)

        descriptor_system.load_item = load_item

        system.descriptor_runtime = descriptor_system

        # construct conditional module:
        cond_location = Location("edX", "conditional_test", "test_run", "conditional", "SampleConditional", None)
        field_data = DictFieldData({
            'data': '<conditional/>',
            'xml_attributes': {'attempted': 'true'},
            'children': [child_descriptor.location],
        })

        cond_descriptor = ConditionalDescriptor(
            descriptor_system,
            field_data,
            ScopeIds(None, None, cond_location, cond_location)
        )
        cond_descriptor.xmodule_runtime = system
        system.get_module = lambda desc: desc
        cond_descriptor.get_required_module_descriptors = Mock(return_value=[source_descriptor])

        # return dict:
        return {'cond_module': cond_descriptor,
                'source_module': source_descriptor,
                'child_module': child_descriptor}
开发者ID:10clouds,项目名称:edx-platform,代码行数:68,代码来源:test_conditional.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.get_test_system函数代码示例发布时间:2022-05-26
下一篇:
Python tabs.CourseTabList类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap