

def testGetArtifacts(self):
    self._LoadAllArtifacts()
    results = artifact_registry.REGISTRY.GetArtifacts(os_name='Windows')
    for result in results:
        self.assertTrue((('Windows' in result.supported_os) or (not result.supported_os)))
    results = artifact_registry.REGISTRY.GetArtifacts(os_name='Windows', name_list=['TestAggregationArtifact', 'TestFileArtifact'])
    self.assertItemsEqual([x.name for x in results], ['TestAggregationArtifact'])
    for result in results:
        self.assertTrue((('Windows' in result.supported_os) or (not result.supported_os)))
    results = artifact_registry.REGISTRY.GetArtifacts(os_name='Windows', source_type=artifact_registry.ArtifactSource.SourceType.REGISTRY_VALUE, name_list=['DepsProvidesMultiple'])
    self.assertEqual(results.pop().name, 'DepsProvidesMultiple')
    results = artifact_registry.REGISTRY.GetArtifacts(os_name='Windows', name_list=['RekallPsList'])
    self.assertEqual(len(results), 1)
    self.assertEqual(results.pop().name, 'RekallPsList')
    results = artifact_registry.REGISTRY.GetArtifacts(os_name='Windows', exclude_dependents=True)
    for result in results:
        self.assertFalse(result.GetArtifactPathDependencies())
    results = artifact_registry.REGISTRY.GetArtifacts(os_name='Windows', provides=['users.homedir', 'domain'])
    for result in results:
        self.assertTrue((len(set(result.provides).union(set(['users.homedir', 'domain']))) >= 1))
    results = artifact_registry.REGISTRY.GetArtifacts(os_name='Windows', provides=['nothingprovidesthis'])
    self.assertEqual(len(results), 0)

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