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


Python NetTestLoader.getTestCases方法代码示例

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


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

示例1: test_load_net_test_multiple_different_options

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [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

示例2: test_require_root_succeed

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [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_with_option

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [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

示例4: test_net_test_inputs

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [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

示例5: test_load_net_test_from_str

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [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

示例6: test_generate_measurements_size

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [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)

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

示例7: test_net_test_inputs

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [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

示例8: test_load_net_test_from_file

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [as 别名]
    def test_load_net_test_from_file(self):
        """
        Given a file verify that the net test cases are properly
        generated.
        """
        __, net_test_file = mkstemp()
        with open(net_test_file, 'w') as f:
            f.write(net_test_string)
        f.close()

        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestFile(net_test_file)

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

示例9: test_load_net_test_multiple

# 需要导入模块: from ooni.nettest import NetTestLoader [as 别名]
# 或者: from ooni.nettest.NetTestLoader import getTestCases [as 别名]
 def test_load_net_test_multiple(self):
     ntl = NetTestLoader(dummyArgs)
     ntl.loadNetTestString(double_net_test_string)
     test_cases = ntl.getTestCases()
     self.verifyMethods(test_cases)
     ntl.checkOptions()
开发者ID:willscott,项目名称:ooni-probe,代码行数:8,代码来源:test_nettest.py


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