Merge branch 'ilyaglow-fix/slow-search'

pull/7/head
Raphaël Vinot 2019-07-25 17:11:19 +02:00
commit edba867c35
2 changed files with 5 additions and 3 deletions

View File

@ -51,9 +51,9 @@ class WarningList():
if self.slow_search and self.type == 'cidr': if self.slow_search and self.type == 'cidr':
self._network_objects = self._network_index() self._network_objects = self._network_index()
# If network objects is empty, reverting to default anyway # If network objects is empty, reverting to default anyway
if not self._network_objects: if not self._network_objects:
self.slow_search = False self.slow_search = False
def __repr__(self): def __repr__(self):
return '<{self.__class__.__name__}(type="{self.name}", version="{self.version}", description="{self.description}")'.format(self=self) return '<{self.__class__.__name__}(type="{self.name}", version="{self.version}", description="{self.description}")'.format(self=self)

View File

@ -44,3 +44,5 @@ class TestPyMISPWarningLists(unittest.TestCase):
self.assertEqual(results[0].name, 'List of RFC 3849 CIDR blocks') self.assertEqual(results[0].name, 'List of RFC 3849 CIDR blocks')
results = self.warninglists.search('1e100.net') results = self.warninglists.search('1e100.net')
self.assertEqual(results[0].name, 'List of known google domains') self.assertEqual(results[0].name, 'List of known google domains')
results = self.warninglists.search('something.files.1drv.com')
self.assertEqual(results[0].name, 'List of known microsoft domains')