Fix tests and API.

pull/3/head
Raphaël Vinot 2017-07-26 15:12:35 +02:00
parent 2f11006ba4
commit a81e0c8653
2 changed files with 4 additions and 4 deletions

View File

@ -209,7 +209,7 @@ class Cluster(collections.Mapping):
def machinetags(self):
to_return = []
for v in self.values:
for v in self.values.values():
to_return.append('misp-galaxy:{}="{}"'.format(self.type, v.value))
return to_return
@ -229,7 +229,7 @@ class Cluster(collections.Mapping):
to_return = {'name': self.name, 'type': self.type, 'source': self.source,
'authors': self.authors, 'description': self.description,
'uuid': self.uuid, 'version': self.version, 'values': []}
for v in self.values:
for v in self.values.values():
to_return['values'].append(v._json())
return to_return

View File

@ -33,7 +33,7 @@ class TestPyMISPGalaxies(unittest.TestCase):
clusters_from_files[cluster['name']] = cluster
for name, c in self.clusters.items():
out = c._json()
self.assertDictEqual(out, clusters_from_files[c.name])
self.assertCountEqual(out, clusters_from_files[c.name])
def test_validate_schema_clusters(self):
self.clusters.validate_with_schema()
@ -44,7 +44,7 @@ class TestPyMISPGalaxies(unittest.TestCase):
def test_meta_additional_properties(self):
# All the properties in the meta key of the bundled-in clusters should be known
for c in self.clusters.values():
for cv in c.values:
for cv in c.values.values():
if cv.meta:
self.assertIsNot(cv.meta.additional_properties, {})