'This tests that we can limit hunts to a number of clients.'

def testClientLimit(self):

    client_ids = self.SetupClients(10)
    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'))])
    with implementation.GRRHunt.StartHunt(hunt_name=standard.SampleHunt.__name__, client_limit=5, client_rule_set=client_rule_set, client_rate=0, token=self.token) as hunt:
        hunt.Run()
    foreman = aff4.FACTORY.Open('aff4:/foreman', mode='rw', token=self.token)
    for client_id in client_ids:
        foreman.AssignTasksToClient(client_id)
    client_mock = hunt_test_lib.SampleHuntMock()
    hunt_test_lib.TestHuntHelper(client_mock, client_ids, False, self.token)
    hunt_obj = aff4.FACTORY.Open(hunt.urn, mode='rw', age=aff4.ALL_TIMES, token=self.token)
    (started, finished, _) = hunt_obj.GetClientsCounts()
    self.assertEqual(started, 5)
    self.assertEqual(finished, 5)
