def TestHuntHelperWithMultipleMocks(client_mocks, check_flow_errors=False, token=None, iteration_limit=None):
 total_flows = set()
 token = token.SetUID()
 client_mocks = [MockClient(client_id, client_mock, token=token) for (client_id, client_mock) in client_mocks.iteritems()]
 worker_mock = MockWorker(check_flow_errors=check_flow_errors, token=token)
 while ((iteration_limit is None) or (iteration_limit > 0)):
  client_processed = 0
  for client_mock in client_mocks:
   client_processed += client_mock.Next()
  flows_run = []
  for flow_run in worker_mock.Next():
   total_flows.add(flow_run)
   flows_run.append(flow_run)
  if ((client_processed == 0) and (not flows_run)):
   break
  if iteration_limit:
   iteration_limit -= 1
 if check_flow_errors:
  CheckFlowErrors(total_flows, token=token)

def TestHuntHelperWithMultipleMocks ( client_mocks , check_flow_errors = False , token = None , iteration_limit = None ) : total_flows = set ( ) token = token . SetUID ( ) client_mocks = [ MockClient ( client_id , client_mock , token = token ) for ( client_id , client_mock ) in client_mocks . iteritems ( ) ] worker_mock = MockWorker ( check_flow_errors = check_flow_errors , token = token ) while ( ( iteration_limit is None ) or ( iteration_limit > 0 ) ) : client_processed = 0 for client_mock in client_mocks : client_processed += client_mock . Next ( ) flows_run = [ ] for flow_run in worker_mock . Next ( ) : total_flows . add ( flow_run ) flows_run . append ( flow_run ) if ( ( client_processed == 0 ) and ( not flows_run ) ) : break if iteration_limit : iteration_limit -= 1 if check_flow_errors : CheckFlowErrors ( total_flows , token = token )
runs a hunt with a given set of clients mocks .