grr/server/grr_response_server/flows/general/collectors_test.py
def testArtifactWithDependencyChain(self):
    """Test an artifact that depends on artifacts with more dependencies."""

    self.cleanup = InitGRRWithTestSources("""
name: Artifact0
doc: An artifact without dependencies.
sources:
supported_os: [Linux]
provides: ["users.desktop"]
---
name: Artifact1
doc: An artifact that depends on Artifact0.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%users.desktop%%/'
provides: ["users.homedir"]
supported_os: [Linux]
---
name: Artifact2
doc: An artifact that depends on Artifact0 and Artifact1.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%users.homedir%%/'
      - '/%%users.desktop%%/'
supported_os: [Linux]
provides: ["os"]
---
name: Artifact3
doc: An artifact that depends on Artifact2.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%os%%/'
supported_os: [Linux]
""")

    artifact_arranger = collectors.ArtifactArranger(
        os_name="Linux", artifacts_name_list=["Artifact3"])
    artifact_list = artifact_arranger.GetArtifactsInProperOrder()
    self.assertEqual(artifact_list,
                     ["Artifact0", "Artifact1", "Artifact2", "Artifact3"])
Test an artifact that depends on artifacts with more dependencies.
Test an artifact that depends on artifacts with more dependencies.
Test an artifact that depends on artifacts with more dependencies .
def testArtifactWithDependencyChain(self):
    self.cleanup = InitGRRWithTestSources("""
name: Artifact0
doc: An artifact without dependencies.
sources:
supported_os: [Linux]
provides: ["users.desktop"]
---
name: Artifact1
doc: An artifact that depends on Artifact0.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%users.desktop%%/'
provides: ["users.homedir"]
supported_os: [Linux]
---
name: Artifact2
doc: An artifact that depends on Artifact0 and Artifact1.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%users.homedir%%/'
      - '/%%users.desktop%%/'
supported_os: [Linux]
provides: ["os"]
---
name: Artifact3
doc: An artifact that depends on Artifact2.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%os%%/'
supported_os: [Linux]
""")
    artifact_arranger = collectors.ArtifactArranger(
        os_name="Linux", artifacts_name_list=["Artifact3"])
    artifact_list = artifact_arranger.GetArtifactsInProperOrder()
    self.assertEqual(artifact_list,
                     ["Artifact0", "Artifact1", "Artifact2", "Artifact3"])
def testArtifactWithDependencyChain ( self ) : self . cleanup = InitGRRWithTestSources ( """
name: Artifact0
doc: An artifact without dependencies.
sources:
supported_os: [Linux]
provides: ["users.desktop"]
---
name: Artifact1
doc: An artifact that depends on Artifact0.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%users.desktop%%/'
provides: ["users.homedir"]
supported_os: [Linux]
---
name: Artifact2
doc: An artifact that depends on Artifact0 and Artifact1.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%users.homedir%%/'
      - '/%%users.desktop%%/'
supported_os: [Linux]
provides: ["os"]
---
name: Artifact3
doc: An artifact that depends on Artifact2.
sources:
- type: FILE
  attributes:
    paths:
      - '/%%os%%/'
supported_os: [Linux]
""" ) artifact_arranger = collectors . ArtifactArranger ( os_name = "Linux" , artifacts_name_list = [ "Artifact3" ] ) artifact_list = artifact_arranger . GetArtifactsInProperOrder ( ) self . assertEqual ( artifact_list , [ "Artifact0" , "Artifact1" , "Artifact2" , "Artifact3" ] )
Test an artifact that depends on artifacts with more dependencies.
Test an artifact that depends on artifacts with more dependencies .
"""Test an artifact that depends on artifacts with more dependencies."""
self