'Check artifact dependencies work.'

def testArtifactsDependencies(self):

    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.assertIn('artifact    recursion    depth', e.exception.message)
    finally:
        source.attributes['names'] = backup
