mirror of https://github.com/MISP/PyMISP
fix: tests are passing fine now
parent
11aaebb5df
commit
47fc0ac3c6
|
@ -68,6 +68,8 @@ class TestComprehensive(unittest.TestCase):
|
||||||
first_event.add_attribute('text', str(uuid4()))
|
first_event.add_attribute('text', str(uuid4()))
|
||||||
first_event.attributes[0].add_tag('admin_only')
|
first_event.attributes[0].add_tag('admin_only')
|
||||||
first_event.attributes[0].add_tag('tlp:white___test')
|
first_event.attributes[0].add_tag('tlp:white___test')
|
||||||
|
first_event.add_attribute('text', str(uuid4()))
|
||||||
|
first_event.attributes[1].add_tag('unique___test')
|
||||||
|
|
||||||
second_event = MISPEvent()
|
second_event = MISPEvent()
|
||||||
second_event.info = 'Second event - org only - medium - ongoing'
|
second_event.info = 'Second event - org only - medium - ongoing'
|
||||||
|
@ -178,7 +180,7 @@ class TestComprehensive(unittest.TestCase):
|
||||||
# Search as admin
|
# Search as admin
|
||||||
attributes = self.admin_misp_connector.search(controller='attributes',
|
attributes = self.admin_misp_connector.search(controller='attributes',
|
||||||
timestamp=first.timestamp.timestamp())
|
timestamp=first.timestamp.timestamp())
|
||||||
self.assertEqual(len(attributes), 7)
|
self.assertEqual(len(attributes), 8)
|
||||||
for a in attributes:
|
for a in attributes:
|
||||||
self.assertIn(a.event_id, [first.id, second.id, third.id])
|
self.assertIn(a.event_id, [first.id, second.id, third.id])
|
||||||
# Search as user
|
# Search as user
|
||||||
|
@ -266,9 +268,10 @@ class TestComprehensive(unittest.TestCase):
|
||||||
for a in e.attributes:
|
for a in e.attributes:
|
||||||
self.assertEqual([t for t in a.tags if t.name == 'foo_double___test'], [])
|
self.assertEqual([t for t in a.tags if t.name == 'foo_double___test'], [])
|
||||||
|
|
||||||
complex_query = self.admin_misp_connector.build_complex_query(not_parameters=['tlp:white___test'])
|
complex_query = self.admin_misp_connector.build_complex_query(or_parameters=['unique___test'],
|
||||||
|
not_parameters=['tlp:white___test'])
|
||||||
events = self.admin_misp_connector.search(tags=complex_query)
|
events = self.admin_misp_connector.search(tags=complex_query)
|
||||||
self.assertEqual(len(events), 2)
|
self.assertEqual(len(events), 1)
|
||||||
for e in events:
|
for e in events:
|
||||||
self.assertIn(e.id, [first.id, second.id])
|
self.assertIn(e.id, [first.id, second.id])
|
||||||
for a in e.attributes:
|
for a in e.attributes:
|
||||||
|
|
Loading…
Reference in New Issue