Fix search, add test

pull/3/head
Raphaël Vinot 2017-07-26 15:29:57 +02:00
parent a81e0c8653
commit 80ab84f86f
2 changed files with 4 additions and 1 deletions

View File

@ -202,7 +202,7 @@ class Cluster(collections.Mapping):
def search(self, query): def search(self, query):
matching = [] matching = []
for v in self.values: for v in self.values.values():
if [s for s in v.searchable if query.lower() in s.lower()]: if [s for s in v.searchable if query.lower() in s.lower()]:
matching.append(v) matching.append(v)
return matching return matching

View File

@ -53,3 +53,6 @@ class TestPyMISPGalaxies(unittest.TestCase):
def test_print(self): def test_print(self):
print(self.clusters) print(self.clusters)
def test_search(self):
self.assertIsNot(len(self.clusters.search('apt')), 0)