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


Python tests.get_test_descriptor_system函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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