diff --git a/pymispgalaxies/api.py b/pymispgalaxies/api.py index a49e6bf..0be6154 100644 --- a/pymispgalaxies/api.py +++ b/pymispgalaxies/api.py @@ -261,7 +261,7 @@ class Clusters(collections.Mapping): def revert_machinetag(self, machinetag): _, cluster_type, cluster_value = re.findall('^([^:]*):([^=]*)="([^"]*)"$', machinetag)[0] cluster = self.clusters[cluster_type] - for v in cluster.values: + for v in cluster.values.values(): if v.value == cluster_value: return cluster, v raise UnableToRevertMachinetag('The machinetag {} could not be found.'.format(machinetag)) diff --git a/tests/tests.py b/tests/tests.py index 8c125b4..25ecb07 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -56,3 +56,6 @@ class TestPyMISPGalaxies(unittest.TestCase): def test_search(self): self.assertIsNot(len(self.clusters.search('apt')), 0) + + def test_revert_machinetag(self): + self.assertEqual(len(self.clusters.revert_machinetag('misp-galaxy:tool="Babar"')), 2)