From c2e643c01beaaff8ba90cd17318a7e07c4d26f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 19 Jun 2020 11:49:38 +0200 Subject: [PATCH] chg: Add test case for search deleted --- tests/testlive_comprehensive.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index 323b3fb..19c0a24 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -542,11 +542,21 @@ class TestComprehensive(unittest.TestCase): obj = MISPObject('file') obj.add_attribute('filename', 'foo') first.add_object(obj) + obj = MISPObject('file') + obj.add_attribute('filename', 'bar') + first.add_object(obj) first = self.user_misp_connector.add_event(first) r = self.user_misp_connector.delete_attribute(first.attributes[0].uuid) self.assertEqual(r['message'], 'Attribute deleted.') r = self.user_misp_connector.delete_object(first.objects[0].uuid) 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) self.assertEqual(r['message'], 'Event deleted.') finally: