'This tests running the hunt on some clients.'

def testHuntModificationWorksCorrectly(self):

    with implementation.GRRHunt.StartHunt(hunt_name=standard.GenericHunt.__name__, flow_runner_args=rdf_flows.FlowRunnerArgs(flow_name=transfer.GetFile.__name__), flow_args=transfer.GetFileArgs(pathspec=rdf_paths.PathSpec(path='/tmp/evil.txt', pathtype=rdf_paths.PathSpec.PathType.OS)), client_rule_set=rdf_foreman.ForemanClientRuleSet(rules=[rdf_foreman.ForemanClientRule(rule_type=rdf_foreman.ForemanClientRule.Type.REGEX, regex=rdf_foreman.ForemanRegexClientRule(attribute_name='GRR    client', attribute_regex='GRR'))]), client_limit=1, client_rate=0, token=self.token) as hunt:
        hunt.Run()
    hunt_session_id = hunt.session_id
    hunt = None
    with aff4.FACTORY.Open('aff4:/foreman', mode='rw', token=self.token) as foreman:
        for client_id in self.client_ids:
            foreman.AssignTasksToClient(client_id)
    client_mock = hunt_test_lib.SampleHuntMock()
    hunt_test_lib.TestHuntHelper(client_mock, self.client_ids, False, self.token)
    hunt_obj = aff4.FACTORY.Open(hunt_session_id, age=aff4.ALL_TIMES, token=self.token)
    (started, _, _) = hunt_obj.GetClientsCounts()
    self.assertEqual(started, 1)
    self.assertEqual(hunt_obj.Get(hunt_obj.Schema.STATE), 'PAUSED')
    with aff4.FACTORY.Open(hunt_session_id, mode='rw', token=self.token) as hunt_obj:
        runner = hunt_obj.GetRunner()
        runner.runner_args.client_limit = 10
        runner.Start()
    with aff4.FACTORY.Open('aff4:/foreman', mode='rw', token=self.token) as foreman:
        for client_id in self.client_ids:
            foreman.AssignTasksToClient(client_id)
    hunt_test_lib.TestHuntHelper(client_mock, self.client_ids, False, self.token)
    hunt_obj = aff4.FACTORY.Open(hunt_session_id, age=aff4.ALL_TIMES, token=self.token)
    (started, _, _) = hunt_obj.GetClientsCounts()
    self.assertEqual(started, 10)
