mirror of https://github.com/MISP/PyMISPGalaxies
Fix tests and API.
parent
2f11006ba4
commit
a81e0c8653
|
@ -209,7 +209,7 @@ class Cluster(collections.Mapping):
|
||||||
|
|
||||||
def machinetags(self):
|
def machinetags(self):
|
||||||
to_return = []
|
to_return = []
|
||||||
for v in self.values:
|
for v in self.values.values():
|
||||||
to_return.append('misp-galaxy:{}="{}"'.format(self.type, v.value))
|
to_return.append('misp-galaxy:{}="{}"'.format(self.type, v.value))
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class Cluster(collections.Mapping):
|
||||||
to_return = {'name': self.name, 'type': self.type, 'source': self.source,
|
to_return = {'name': self.name, 'type': self.type, 'source': self.source,
|
||||||
'authors': self.authors, 'description': self.description,
|
'authors': self.authors, 'description': self.description,
|
||||||
'uuid': self.uuid, 'version': self.version, 'values': []}
|
'uuid': self.uuid, 'version': self.version, 'values': []}
|
||||||
for v in self.values:
|
for v in self.values.values():
|
||||||
to_return['values'].append(v._json())
|
to_return['values'].append(v._json())
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class TestPyMISPGalaxies(unittest.TestCase):
|
||||||
clusters_from_files[cluster['name']] = cluster
|
clusters_from_files[cluster['name']] = cluster
|
||||||
for name, c in self.clusters.items():
|
for name, c in self.clusters.items():
|
||||||
out = c._json()
|
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):
|
def test_validate_schema_clusters(self):
|
||||||
self.clusters.validate_with_schema()
|
self.clusters.validate_with_schema()
|
||||||
|
@ -44,7 +44,7 @@ class TestPyMISPGalaxies(unittest.TestCase):
|
||||||
def test_meta_additional_properties(self):
|
def test_meta_additional_properties(self):
|
||||||
# All the properties in the meta key of the bundled-in clusters should be known
|
# All the properties in the meta key of the bundled-in clusters should be known
|
||||||
for c in self.clusters.values():
|
for c in self.clusters.values():
|
||||||
for cv in c.values:
|
for cv in c.values.values():
|
||||||
if cv.meta:
|
if cv.meta:
|
||||||
self.assertIsNot(cv.meta.additional_properties, {})
|
self.assertIsNot(cv.meta.additional_properties, {})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue