

def testArtifactsDependencies(self):
    'Check artifact dependencies work.'
    artifact_reg = artifact_registry.REGISTRY
    art_obj = artifact_reg.GetArtifact('TestAggregationArtifactDeps')
    deps = art_obj.GetArtifactDependencies()
    self.assertItemsEqual(list(deps), ['TestAggregationArtifact'])
    deps = art_obj.GetArtifactDependencies(recursive=True)
    self.assertItemsEqual(list(deps), ['TestOSAgnostic', 'TestCmdArtifact', 'TestAggregationArtifact'])
    source = art_obj.sources[0]
    backup = source.attributes['names']
    try:
        source.attributes['names'] = ['TestAggregationArtifactDeps']
        with self.assertRaises(RuntimeError) as e:
            deps = art_obj.GetArtifactDependencies(recursive=True)
        self.assertTrue(('artifact recursion depth' in e.exception.message))
    finally:
        source.attributes['names'] = backup

dataset/ETHPy150Open google/grr/grr/lib/artifact_utils_test.py ArtifactHandlingTest.testArtifactsDependencies/original