grr/server/grr_response_server/flows/general/collectors_test.py
def testRunGrrClientActionArtifact(self):
    """Test we can get a GRR client artifact."""
    client_id = self.SetupClient(0, system="Linux")
    with utils.Stubber(psutil, "process_iter", ProcessIter):
      client_mock = action_mocks.ActionMock(standard.ListProcesses)

      coll1 = rdf_artifacts.ArtifactSource(
          type=rdf_artifacts.ArtifactSource.SourceType.GRR_CLIENT_ACTION,
          attributes={"client_action": standard.ListProcesses.__name__})
      self.fakeartifact.sources.append(coll1)
      artifact_list = ["FakeArtifact"]
      session_id = flow_test_lib.TestFlowHelper(
          aff4_flows.ArtifactCollectorFlow.__name__,
          client_mock,
          artifact_list=artifact_list,
          token=self.token,
          client_id=client_id)

      results = flow_test_lib.GetFlowResults(client_id, session_id)
      self.assertIsInstance(results[0], rdf_client.Process)
      self.assertLen(results, 1)
Test we can get a GRR client artifact.
Test we can get a GRR client artifact.
Test we can get a GRR client artifact .
def testRunGrrClientActionArtifact(self):
    client_id = self.SetupClient(0, system="Linux")
    with utils.Stubber(psutil, "process_iter", ProcessIter):
      client_mock = action_mocks.ActionMock(standard.ListProcesses)
      coll1 = rdf_artifacts.ArtifactSource(
          type=rdf_artifacts.ArtifactSource.SourceType.GRR_CLIENT_ACTION,
          attributes={"client_action": standard.ListProcesses.__name__})
      self.fakeartifact.sources.append(coll1)
      artifact_list = ["FakeArtifact"]
      session_id = flow_test_lib.TestFlowHelper(
          aff4_flows.ArtifactCollectorFlow.__name__,
          client_mock,
          artifact_list=artifact_list,
          token=self.token,
          client_id=client_id)
      results = flow_test_lib.GetFlowResults(client_id, session_id)
      self.assertIsInstance(results[0], rdf_client.Process)
      self.assertLen(results, 1)
def testRunGrrClientActionArtifact ( self ) : client_id = self . SetupClient ( 0 , system = "Linux" ) with utils . Stubber ( psutil , "process_iter" , ProcessIter ) : client_mock = action_mocks . ActionMock ( standard . ListProcesses ) coll1 = rdf_artifacts . ArtifactSource ( type = rdf_artifacts . ArtifactSource . SourceType . GRR_CLIENT_ACTION , attributes = { "client_action" : standard . ListProcesses . __name__ } ) self . fakeartifact . sources . append ( coll1 ) artifact_list = [ "FakeArtifact" ] session_id = flow_test_lib . TestFlowHelper ( aff4_flows . ArtifactCollectorFlow . __name__ , client_mock , artifact_list = artifact_list , token = self . token , client_id = client_id ) results = flow_test_lib . GetFlowResults ( client_id , session_id ) self . assertIsInstance ( results [ 0 ] , rdf_client . Process ) self . assertLen ( results , 1 )
Test we can get a GRR client artifact.
Test we can get a GRR client artifact .
"""Test we can get a GRR client artifact."""
self