本文整理汇总了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)
示例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)
示例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())
示例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)
示例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())
示例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)
示例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)
示例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)
示例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()