mirror of https://github.com/MISP/PyMISP
fix: Test case on reference
parent
c9b5d24073
commit
24594a5aea
|
@ -1489,6 +1489,7 @@ class MISPObject(AbstractMISP):
|
||||||
relationship_type=relationship_type, comment=comment, **kwargs)
|
relationship_type=relationship_type, comment=comment, **kwargs)
|
||||||
self.ObjectReference.append(reference)
|
self.ObjectReference.append(reference)
|
||||||
self.edited = True
|
self.edited = True
|
||||||
|
return reference
|
||||||
|
|
||||||
def get_attributes_by_relation(self, object_relation):
|
def get_attributes_by_relation(self, object_relation):
|
||||||
'''Returns the list of attributes with the given object relation in the object'''
|
'''Returns the list of attributes with the given object relation in the object'''
|
||||||
|
|
|
@ -87,7 +87,8 @@ class TestMISPEvent(unittest.TestCase):
|
||||||
del a.uuid
|
del a.uuid
|
||||||
self.mispevent.objects[0].uuid = 'a'
|
self.mispevent.objects[0].uuid = 'a'
|
||||||
self.mispevent.objects[1].uuid = 'b'
|
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')
|
self.assertEqual(self.mispevent.objects[0].references[0].relationship_type, 'baz')
|
||||||
with open('tests/mispevent_testfiles/event_obj_attr_tag.json', 'r') as f:
|
with open('tests/mispevent_testfiles/event_obj_attr_tag.json', 'r') as f:
|
||||||
ref_json = json.load(f)
|
ref_json = json.load(f)
|
||||||
|
|
Loading…
Reference in New Issue