當前位置: 首頁>>代碼示例>>Python>>正文


Python TestRuntime.render方法代碼示例

本文整理匯總了Python中xblock.test.tools.TestRuntime.render方法的典型用法代碼示例。如果您正苦於以下問題:Python TestRuntime.render方法的具體用法?Python TestRuntime.render怎麽用?Python TestRuntime.render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xblock.test.tools.TestRuntime的用法示例。


在下文中一共展示了TestRuntime.render方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_sub_service

# 需要導入模塊: from xblock.test.tools import TestRuntime [as 別名]
# 或者: from xblock.test.tools.TestRuntime import render [as 別名]
def test_sub_service():
    runtime = TestRuntime(id_reader=Mock(), services={
        'secret_service': 17,
        'field-data': DictFieldData({}),
    })
    tester = SubXBlockWithServices(runtime, scope_ids=Mock(spec=ScopeIds))

    # Call the student_view to run its assertions.
    runtime.render(tester, 'student_view')
開發者ID:edx-solutions,項目名稱:XBlock,代碼行數:11,代碼來源:test_runtime.py

示例2: test_service

# 需要導入模塊: from xblock.test.tools import TestRuntime [as 別名]
# 或者: from xblock.test.tools.TestRuntime import render [as 別名]
def test_service():
    runtime = TestRuntime(services={"secret_service": 17, "field-data": DictFieldData({})})
    block_type = "test"
    def_id = runtime.id_generator.create_definition(block_type)
    usage_id = runtime.id_generator.create_usage(def_id)
    tester = XBlockWithServices(runtime, scope_ids=ScopeIds("user", block_type, def_id, usage_id))

    # Call the student_view to run its assertions.
    runtime.render(tester, "student_view")
開發者ID:sudogroot,項目名稱:XBlock,代碼行數:11,代碼來源:test_runtime.py

示例3: test_service

# 需要導入模塊: from xblock.test.tools import TestRuntime [as 別名]
# 或者: from xblock.test.tools.TestRuntime import render [as 別名]
def test_service():
    runtime = TestRuntime(services={
        'secret_service': 17,
        'field-data': DictFieldData({}),
    })
    block_type = 'test'
    def_id = runtime.id_generator.create_definition(block_type)
    usage_id = runtime.id_generator.create_usage(def_id)
    tester = XBlockWithServices(runtime, scope_ids=ScopeIds('user', block_type, def_id, usage_id))

    # Call the student_view to run its assertions.
    runtime.render(tester, 'student_view')
開發者ID:edx-solutions,項目名稱:XBlock,代碼行數:14,代碼來源:test_runtime.py

示例4: TestAsides

# 需要導入模塊: from xblock.test.tools import TestRuntime [as 別名]
# 或者: from xblock.test.tools.TestRuntime import render [as 別名]
class TestAsides(TestCase):
    """
    Tests of XBlockAsides.
    """
    def setUp(self):
        key_store = DictKeyValueStore()
        field_data = KvsFieldData(key_store)
        self.runtime = TestRuntime(services={'field-data': field_data})
        block_type = 'test'
        def_id = self.runtime.id_generator.create_definition(block_type)
        usage_id = self.runtime.id_generator.create_usage(def_id)
        self.tester = TestXBlock(self.runtime, scope_ids=ScopeIds('user', block_type, def_id, usage_id))

    @XBlockAside.register_temp_plugin(TestAside)
    def test_render_aside(self):
        """
        Test that rendering the xblock renders its aside
        """

        frag = self.runtime.render(self.tester, 'student_view', [u"ignore"])
        self.assertIn(TestAside.FRAG_CONTENT, frag.body_html())

        frag = self.runtime.render(self.tester, 'author_view', [u"ignore"])
        self.assertNotIn(TestAside.FRAG_CONTENT, frag.body_html())

    @XBlockAside.register_temp_plugin(TestAside)
    @XBlockAside.register_temp_plugin(TestInheritedAside)
    def test_inherited_aside_view(self):
        """
        Test that rendering the xblock renders its aside (when the aside view is
        inherited).
        """
        frag = self.runtime.render(self.tester, 'student_view', [u"ignore"])
        self.assertIn(TestAside.FRAG_CONTENT, frag.body_html())
        self.assertIn(TestInheritedAside.FRAG_CONTENT, frag.body_html())

        frag = self.runtime.render(self.tester, 'author_view', [u"ignore"])
        self.assertNotIn(TestAside.FRAG_CONTENT, frag.body_html())
        self.assertNotIn(TestInheritedAside.FRAG_CONTENT, frag.body_html())
開發者ID:Jianbinma,項目名稱:XBlock,代碼行數:41,代碼來源:test_asides.py

示例5: test_service

# 需要導入模塊: from xblock.test.tools import TestRuntime [as 別名]
# 或者: from xblock.test.tools.TestRuntime import render [as 別名]
def test_service():
    runtime = TestRuntime(services={'secret_service': 17})
    tester = XBlockWithServices(runtime, scope_ids=Mock(spec=ScopeIds))

    # Call the student_view to run its assertions.
    runtime.render(tester, 'student_view')
開發者ID:Maqlan,項目名稱:XBlock,代碼行數:8,代碼來源:test_runtime.py


注:本文中的xblock.test.tools.TestRuntime.render方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。