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


Python NetTestLoader.loadNetTestString方法代码示例

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


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

示例1: test_load_with_missing_required_option

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_load_with_missing_required_option(self):
        try:
            ntl = NetTestLoader(dummyArgs)
            ntl.loadNetTestString(net_test_string_with_required_option)

        except MissingRequiredOption:
            pass
开发者ID:qlimaxx,项目名称:ooni-probe-dev,代码行数:9,代码来源:test_nettest.py

示例2: test_require_root_succeed

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_require_root_succeed(self):
        # XXX: will require root to run
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(net_test_root_required)

        for test_class, methods in ntl.getTestCases():
            self.assertTrue(test_class.requiresRoot)
开发者ID:willscott,项目名称:ooni-probe,代码行数:9,代码来源:test_nettest.py

示例3: test_load_net_test_multiple_different_options

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_load_net_test_multiple_different_options(self):
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(double_different_options_net_test_string)

        test_cases = ntl.getTestCases()
        self.verifyMethods(test_cases)
        self.assertRaises(IncoherentOptions, ntl.checkOptions)
开发者ID:willscott,项目名称:ooni-probe,代码行数:9,代码来源:test_nettest.py

示例4: test_singular_input_processor

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_singular_input_processor(self):
        """
        Verify that all measurements use the same object as their input processor.
        """
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(generator_id_net_test)
        ntl.checkOptions()

        director = Director()
        self.filename = 'dummy_report.yamloo'
        d = director.startNetTest(ntl, self.filename)

        @d.addCallback
        def complete(result):
            with open(self.filename) as report_file:
                all_report_entries = yaml.safe_load_all(report_file)
                header = all_report_entries.next()
                results_case_a = all_report_entries.next()
                aa_test, ab_test, ac_test = results_case_a.get('results', [])
                results_case_b = all_report_entries.next()
                ba_test = results_case_b.get('results', [])[0]
            # Within a NetTestCase an inputs object will be consistent
            self.assertEqual(aa_test, ab_test, ac_test)
            # An inputs object will be different between different NetTestCases
            self.assertNotEqual(aa_test, ba_test)

        return d
开发者ID:willscott,项目名称:ooni-probe,代码行数:29,代码来源:test_nettest.py

示例5: test_load_with_option

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_load_with_option(self):
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(net_test_string)

        self.assertIsInstance(ntl, NetTestLoader)
        for test_klass, test_meth in ntl.getTestCases():
            for option in dummyOptions.keys():
                self.assertIn(option, test_klass.usageOptions())
开发者ID:willscott,项目名称:ooni-probe,代码行数:10,代码来源:test_nettest.py

示例6: test_load_net_test_multiple_different_options

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_load_net_test_multiple_different_options(self):
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(double_different_options_net_test_string)

        self.verifyMethods(ntl.testCases)
        self.verifyClasses(ntl.testCases, set(('DummyTestCaseA', 'DummyTestCaseB')))

        self.assertRaises(IncoherentOptions, ntl.checkOptions)
开发者ID:0xPoly,项目名称:ooni-probe,代码行数:10,代码来源:test_nettest.py

示例7: test_setup_local_options_in_test_cases

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_setup_local_options_in_test_cases(self):
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(net_test_string)

        ntl.checkOptions()

        for test_class, test_method in ntl.testCases:
            self.assertEqual(test_class.localOptions, dummyOptions)
开发者ID:qlimaxx,项目名称:ooni-probe-dev,代码行数:10,代码来源:test_nettest.py

示例8: test_load_net_test_multiple

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_load_net_test_multiple(self):
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(double_net_test_string)

        self.verifyMethods(ntl.testCases)
        self.verifyClasses(ntl.testCases, set(('DummyTestCaseA', 'DummyTestCaseB')))

        ntl.checkOptions()
开发者ID:0xPoly,项目名称:ooni-probe,代码行数:10,代码来源:test_nettest.py

示例9: test_load_net_test_from_str

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_load_net_test_from_str(self):
        """
        Given a file like object verify that the net test cases are properly
        generated.
        """
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(net_test_string)

        self.verifyMethods(ntl.getTestCases())
开发者ID:willscott,项目名称:ooni-probe,代码行数:11,代码来源:test_nettest.py

示例10: test_net_test_inputs

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)
        ntl.checkOptions()
        nt = NetTest(ntl.getTestCases(), ntl.getTestDetails(), None)
        yield nt.initialize()

        for test_class, test_methods in nt.testCases:
            self.assertEqual(len(list(test_class.inputs)), 10)
开发者ID:willscott,项目名称:ooni-probe,代码行数:11,代码来源:test_nettest.py

示例11: test_load_with_invalid_option

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_load_with_invalid_option(self):
        try:
            ntl = NetTestLoader(dummyInvalidArgs)
            ntl.loadNetTestString(net_test_string)

            ntl.checkOptions()
            raise Exception
        except UsageError:
            pass
开发者ID:qlimaxx,项目名称:ooni-probe-dev,代码行数:11,代码来源:test_nettest.py

示例12: test_generate_measurements_size

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_generate_measurements_size(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)

        ntl.checkOptions()
        net_test = NetTest(ntl, None)

        measurements = list(net_test.generateMeasurements())
        self.assertEqual(len(measurements), 20)
开发者ID:alexwebr,项目名称:ooni-probe,代码行数:11,代码来源:test_nettest.py

示例13: test_generate_measurements_size

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_generate_measurements_size(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)
        ntl.checkOptions()

        net_test = NetTest(ntl.getTestCases(), ntl.getTestDetails(), None)

        net_test.initializeInputProcessor()
        measurements = list(net_test.generateMeasurements())
        self.assertEqual(len(measurements), 20)
开发者ID:Samdney,项目名称:ooni-probe,代码行数:12,代码来源:test_nettest.py

示例14: test_net_test_inputs

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)
        ntl.checkOptions()
        nt = NetTest(ntl.getTestCases(), ntl.getTestDetails(), None)
        nt.initializeInputProcessor()

        # XXX: if you use the same test_class twice you will have consumed all
        # of its inputs!
        tested = set([])
        for test_instance, test_method, inputs in nt.testInstances:
            self.assertEqual(len(list(inputs)), 10)
开发者ID:Samdney,项目名称:ooni-probe,代码行数:14,代码来源:test_nettest.py

示例15: test_net_test_inputs

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import loadNetTestString [as 别名]
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)

        ntl.checkOptions()

        # XXX: if you use the same test_class twice you will have consumed all
        # of its inputs!
        tested = set([])
        for test_class, test_method in ntl.testCases:
            if test_class not in tested:
                tested.update([test_class])
                self.assertEqual(len(list(test_class.inputs)), 10)
开发者ID:alexwebr,项目名称:ooni-probe,代码行数:15,代码来源:test_nettest.py


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