mirror of https://github.com/MISP/PyMISP
chg: Add test case for search deleted
parent
c8d66365c5
commit
c2e643c01b
|
@ -542,11 +542,21 @@ class TestComprehensive(unittest.TestCase):
|
||||||
obj = MISPObject('file')
|
obj = MISPObject('file')
|
||||||
obj.add_attribute('filename', 'foo')
|
obj.add_attribute('filename', 'foo')
|
||||||
first.add_object(obj)
|
first.add_object(obj)
|
||||||
|
obj = MISPObject('file')
|
||||||
|
obj.add_attribute('filename', 'bar')
|
||||||
|
first.add_object(obj)
|
||||||
first = self.user_misp_connector.add_event(first)
|
first = self.user_misp_connector.add_event(first)
|
||||||
r = self.user_misp_connector.delete_attribute(first.attributes[0].uuid)
|
r = self.user_misp_connector.delete_attribute(first.attributes[0].uuid)
|
||||||
self.assertEqual(r['message'], 'Attribute deleted.')
|
self.assertEqual(r['message'], 'Attribute deleted.')
|
||||||
r = self.user_misp_connector.delete_object(first.objects[0].uuid)
|
r = self.user_misp_connector.delete_object(first.objects[0].uuid)
|
||||||
self.assertEqual(r['message'], 'Object deleted')
|
self.assertEqual(r['message'], 'Object deleted')
|
||||||
|
r = self.user_misp_connector.search(event_id=first.id, deleted=[0, 1], pythonify=True)
|
||||||
|
self.assertTrue(isinstance(r[0], MISPEvent))
|
||||||
|
self.assertEqual(len(r[0].objects), 2)
|
||||||
|
self.assertTrue(r[0].objects[0].deleted)
|
||||||
|
self.assertFalse(r[0].objects[1].deleted)
|
||||||
|
self.assertEqual(len(r[0].attributes), 1)
|
||||||
|
self.assertTrue(r[0].attributes[0].deleted)
|
||||||
r = self.user_misp_connector.delete_event(first.uuid)
|
r = self.user_misp_connector.delete_event(first.uuid)
|
||||||
self.assertEqual(r['message'], 'Event deleted.')
|
self.assertEqual(r['message'], 'Event deleted.')
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue