chg: Add testcase with breakOnDuplicate in a MISPObject

pull/700/head
Raphaël Vinot 2021-01-21 12:27:45 +01:00
parent 65b257d760
commit 79aff124d4
1 changed files with 5 additions and 0 deletions

View File

@ -1450,6 +1450,11 @@ class TestComprehensive(unittest.TestCase):
r = self.user_misp_connector.add_object(first, peo_dup, break_on_duplicate=True) r = self.user_misp_connector.add_object(first, peo_dup, break_on_duplicate=True)
self.assertTrue("Duplicate object found" in r['errors'][1]['errors'], r) self.assertTrue("Duplicate object found" in r['errors'][1]['errors'], r)
# Test break on duplicate with breakOnDuplicate key in object
fo_dup.breakOnDuplicate = True
r = self.user_misp_connector.add_object(first, fo_dup)
self.assertTrue("Duplicate object found" in r['errors'][1]['errors'], r)
# Test refs # Test refs
r = self.user_misp_connector.add_object_reference(fo.ObjectReference[0]) r = self.user_misp_connector.add_object_reference(fo.ObjectReference[0])
self.assertEqual(r.object_uuid, fo.uuid, r.to_json()) self.assertEqual(r.object_uuid, fo.uuid, r.to_json())