コード例 #1
0
 def test_bouncer_client_lookup_collector(self):
     bcc = BouncerClient('https://bouncer.ooni.io')
     bcc.queryBackend = MagicMock()
     bcc.queryBackend.return_value = defer.succeed({})
     yield bcc.lookupTestCollector(["foo"])
     bcc.queryBackend.assert_called_with("POST",
                                         "/bouncer/net-tests",
                                         query={'net-tests': ["foo"]})
コード例 #2
0
 def test_bouncer_client_lookup_collector(self):
     bcc = BouncerClient('https://bouncer.ooni.io')
     bcc.queryBackend = MagicMock()
     bcc.queryBackend.return_value = defer.succeed({})
     yield bcc.lookupTestCollector(["foo"])
     bcc.queryBackend.assert_called_with("POST",
                                         "/bouncer/net-tests",
                                         query={'net-tests': ["foo"]})
コード例 #3
0
def lookup_collector_client(report_header, bouncer):
    oonib_client = BouncerClient(bouncer)
    net_tests = [{
        'test-helpers': [],
        'input-hashes': report_header['input_hashes'],
        'name': report_header['test_name'],
        'version': report_header['test_version'],
    }]
    result = yield oonib_client.lookupTestCollector(net_tests)
    collector_client = CollectorClient(
        address=result['net-tests'][0]['collector'])
    defer.returnValue(collector_client)
コード例 #4
0
ファイル: tool.py プロジェクト: irl/ooni-probe
def lookup_collector_client(report_header, bouncer):
    oonib_client = BouncerClient(bouncer)
    net_tests = [{
        'test-helpers': [],
        'input-hashes': report_header['input_hashes'],
        'name': report_header['test_name'],
        'version': report_header['test_version'],
    }]
    result = yield oonib_client.lookupTestCollector(
        net_tests
    )
    collector_client = CollectorClient(
        address=result['net-tests'][0]['collector']
    )
    defer.returnValue(collector_client)