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


Python Director.start_net_test_loader方法代码示例

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


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

示例1: test_singular_input_processor

# 需要导入模块: from ooni.director import Director [as 别名]
# 或者: from ooni.director.Director import start_net_test_loader [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.njson'
        d = director.start_net_test_loader(ntl, self.filename)

        @d.addCallback
        def complete(result):
            with open(self.filename) as report_file:
                all_report_entries = map(json.loads, report_file)
                results_case_a = all_report_entries[0]['test_keys']
                aa_test, ab_test, ac_test = results_case_a.get('results', [])
                results_case_b = all_report_entries[1]['test_keys']
                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:TheTorProject,项目名称:ooni-probe,代码行数:28,代码来源:test_nettest.py

示例2: test_run_test_fails_twice

# 需要导入模块: from ooni.director import Director [as 别名]
# 或者: from ooni.director.Director import start_net_test_loader [as 别名]
    def test_run_test_fails_twice(self):
        finished = defer.Deferred()

        def net_test_done(net_test):
            summary_items = net_test.summary.items()
            self.assertEqual(len(summary_items), 50)
            for input_name, run_count in summary_items:
                self.assertEqual(run_count, 3)
            finished.callback(None)

        net_test_loader = NetTestLoader(('spam','ham'))
        net_test_loader.loadNetTestString(test_failing_twice)
        director = Director()
        director.netTestDone = net_test_done
        director.start_net_test_loader(net_test_loader, None, no_yamloo=True)
        return finished
开发者ID:TheTorProject,项目名称:ooni-probe,代码行数:18,代码来源:test_director.py

示例3: test_nettest_timeout

# 需要导入模块: from ooni.director import Director [as 别名]
# 或者: from ooni.director.Director import start_net_test_loader [as 别名]
    def test_nettest_timeout(self):
        ntl = NetTestLoader(('-u', 'http://localhost:8007/'))
        ntl.loadNetTestString(http_net_test)

        ntl.checkOptions()
        director = Director()

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

        @d.addCallback
        def complete(result):
            assert director.failedMeasurements == 1

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

示例4: test_net_test_completed_callback

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

        ntl.checkOptions()
        director = Director()

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

        @d.addCallback
        def complete(result):
            self.assertEqual(result, None)
            self.assertEqual(director.successfulMeasurements, 20)

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

示例5: test_send_to_inputs_generator

# 需要导入模块: from ooni.director import Director [as 别名]
# 或者: from ooni.director.Director import start_net_test_loader [as 别名]
    def test_send_to_inputs_generator(self):
        """
        Verify that a net test can send information back into an inputs generator.
        """
        ntl = NetTestLoader(dummyArgs)
        ntl.loadNetTestString(generator_net_test)
        ntl.checkOptions()

        director = Director()
        self.filename = 'dummy_report.njson'
        d = director.start_net_test_loader(ntl, self.filename)

        @d.addCallback
        def complete(result):
            with open(self.filename) as report_file:
                all_report_entries = map(json.loads, report_file)
                results = [x['input'] for x in all_report_entries]
            self.assertEqual(results, [9, 8, 7, 6, 5, 5, 3, 2, 1, 0])

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


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