fix: Test case on reference

pull/511/head
Raphaël Vinot 2019-12-11 23:38:41 +01:00
parent c9b5d24073
commit 24594a5aea
2 changed files with 3 additions and 1 deletions

View File

@ -1489,6 +1489,7 @@ class MISPObject(AbstractMISP):
relationship_type=relationship_type, comment=comment, **kwargs)
self.ObjectReference.append(reference)
self.edited = True
return reference
def get_attributes_by_relation(self, object_relation):
'''Returns the list of attributes with the given object relation in the object'''

View File

@ -87,7 +87,8 @@ class TestMISPEvent(unittest.TestCase):
del a.uuid
self.mispevent.objects[0].uuid = 'a'
self.mispevent.objects[1].uuid = 'b'
self.mispevent.objects[0].add_reference(self.mispevent.objects[1], 'baz', comment='foo')
reference = self.mispevent.objects[0].add_reference(self.mispevent.objects[1], 'baz', comment='foo')
del reference.uuid
self.assertEqual(self.mispevent.objects[0].references[0].relationship_type, 'baz')
with open('tests/mispevent_testfiles/event_obj_attr_tag.json', 'r') as f:
ref_json = json.load(f)