#NEWLINE# def testHuntNotifications( self ) : #NEWLINE# #INDENT# 'This tests the Hunt notification event.' #NEWLINE# TestHuntListener . received_events = [ ] #NEWLINE# client_ids = self . SetupClients ( 10 ) #NEWLINE# with hunts . GRRHunt . StartHunt ( hunt_name = 'BrokenSampleHunt' , regex_rules = [ rdf_foreman . ForemanAttributeRegex ( attribute_name = 'GRR client' , attribute_regex = 'GRR' ) ] , client_rate = 0 , notification_event = 'TestHuntDone' , token = self . token ) as hunt : #NEWLINE# #INDENT# hunt . GetRunner ( ) . Start ( ) #NEWLINE# #UNINDENT# foreman = aff4 . FACTORY . Open ( 'aff4:/foreman' , mode = 'rw' , token = self . token ) #NEWLINE# for client_id in client_ids : #NEWLINE# #INDENT# foreman . AssignTasksToClient ( client_id ) #NEWLINE# #UNINDENT# client_mock = test_lib . SampleHuntMock ( ) #NEWLINE# test_lib . TestHuntHelper ( client_mock , self , check_flow_errors = False , token = self . token ) #NEWLINE# self . assertEqual ( len ( TestHuntListener . received_events ) , 5 )