mirror of https://github.com/MISP/PyMISP
fix: Add attribute dict as proposal
parent
7b08cfcade
commit
ded44278af
|
@ -600,7 +600,7 @@ class PyMISP:
|
||||||
and new_attribute['errors'][1]['message'] == 'You do not have permission to do that.'):
|
and new_attribute['errors'][1]['message'] == 'You do not have permission to do that.'):
|
||||||
# At this point, we assume the user tried to add an attribute on an event they don't own
|
# At this point, we assume the user tried to add an attribute on an event they don't own
|
||||||
# Re-try with a proposal
|
# Re-try with a proposal
|
||||||
if isinstance(attribute, MISPAttribute):
|
if isinstance(attribute, (MISPAttribute, dict)):
|
||||||
return self.add_attribute_proposal(event_id, attribute, pythonify)
|
return self.add_attribute_proposal(event_id, attribute, pythonify)
|
||||||
if not (self.global_pythonify or pythonify) or 'errors' in new_attribute:
|
if not (self.global_pythonify or pythonify) or 'errors' in new_attribute:
|
||||||
return new_attribute
|
return new_attribute
|
||||||
|
|
|
@ -1740,7 +1740,7 @@ class TestComprehensive(unittest.TestCase):
|
||||||
self.assertTrue(isinstance(attribute, MISPShadowAttribute), attribute)
|
self.assertTrue(isinstance(attribute, MISPShadowAttribute), attribute)
|
||||||
# Test if add proposal without category works - https://github.com/MISP/MISP/issues/4868
|
# Test if add proposal without category works - https://github.com/MISP/MISP/issues/4868
|
||||||
attribute = self.user_misp_connector.add_attribute(second.id, {'type': 'ip-dst', 'value': '123.43.32.22'})
|
attribute = self.user_misp_connector.add_attribute(second.id, {'type': 'ip-dst', 'value': '123.43.32.22'})
|
||||||
self.assertTrue(isinstance(attribute, MISPShadowAttribute))
|
self.assertTrue(isinstance(attribute, MISPShadowAttribute), attribute)
|
||||||
# Add attribute with the same value as an existing proposal
|
# Add attribute with the same value as an existing proposal
|
||||||
prop_attr.uuid = str(uuid4())
|
prop_attr.uuid = str(uuid4())
|
||||||
attribute = self.admin_misp_connector.add_attribute(second, prop_attr, pythonify=True)
|
attribute = self.admin_misp_connector.add_attribute(second, prop_attr, pythonify=True)
|
||||||
|
|
Loading…
Reference in New Issue