#NEWLINE# def testCheckFlowRequestLimit( self ) : #NEWLINE# #INDENT# with test_lib . FakeTime ( self . BASE_TIME ) : #NEWLINE# #INDENT# flow . GRRFlow . StartFlow ( client_id = self . client_id , flow_name = 'DummyLogFlow' , token = self . token ) #NEWLINE# #UNINDENT# with test_lib . FakeTime ( ( ( self . BASE_TIME + 86400 ) + 1 ) ) : #NEWLINE# #INDENT# flow . GRRFlow . StartFlow ( client_id = self . client_id , flow_name = 'DummyLogFlow' , token = self . token ) #NEWLINE# throttler = throttle . FlowThrottler ( daily_req_limit = 2 , dup_interval = rdfvalue . Duration ( '0s' ) ) #NEWLINE# throttler . EnforceLimits ( self . client_id , self . token . username , 'DummyLogFlow' , None , token = self . token ) #NEWLINE# token2 = access_control . ACLToken ( username = 'test2' , reason = 'Running tests' ) #NEWLINE# flow . GRRFlow . StartFlow ( client_id = self . client_id , flow_name = 'DummyLogFlow' , token = token2 ) #NEWLINE# flow . GRRFlow . StartFlow ( client_id = self . client_id , flow_name = 'DummyLogFlow' , token = token2 ) #NEWLINE# throttler . EnforceLimits ( self . client_id , self . token . username , 'DummyLogFlow' , None , token = self . token ) #NEWLINE# flow . GRRFlow . StartFlow ( client_id = self . client_id , flow_name = 'DummyLogFlow' , token = self . token ) #NEWLINE# with self . assertRaises ( throttle . ErrorDailyFlowRequestLimitExceeded ) : #NEWLINE# #INDENT# throttler . EnforceLimits ( self . client_id , self . token . username , 'DummyLogFlow' , None , token = self . token )