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"]})
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)
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)