chg: Update tests

pull/3/head
Raphaël Vinot 2018-03-22 16:20:10 +01:00
parent 2bfcb0b226
commit a1b5c091fe
1 changed files with 12 additions and 1 deletions

View File

@ -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')):