mirror of https://github.com/MISP/PyMISPGalaxies
chg: Update tests
parent
2bfcb0b226
commit
a1b5c091fe
|
@ -6,15 +6,26 @@ from pymispgalaxies import Galaxies, Clusters, UnableToRevertMachinetag
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
from collections import Counter
|
||||||
|
|
||||||
|
|
||||||
class TestPyMISPGalaxies(unittest.TestCase):
|
class TestPyMISPGalaxies(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.galaxies = Galaxies()
|
self.galaxies = Galaxies()
|
||||||
self.clusters = Clusters()
|
self.clusters = Clusters(skip_duplicates=True)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
|
def test_duplicates(self):
|
||||||
|
has_duplicates = False
|
||||||
|
for name, c in self.clusters.items():
|
||||||
|
if c.duplicates:
|
||||||
|
has_duplicates = True
|
||||||
|
to_print = Counter(c.duplicates)
|
||||||
|
for entry, counter in to_print.items():
|
||||||
|
print(counter + 1, entry)
|
||||||
|
self.assertFalse(has_duplicates)
|
||||||
|
|
||||||
def test_dump_galaxies(self):
|
def test_dump_galaxies(self):
|
||||||
galaxies_from_files = {}
|
galaxies_from_files = {}
|
||||||
for galaxy_file in glob(os.path.join(self.galaxies.root_dir_galaxies, '*.json')):
|
for galaxy_file in glob(os.path.join(self.galaxies.root_dir_galaxies, '*.json')):
|
||||||
|
|
Loading…
Reference in New Issue