diff --git a/pymisp/api.py b/pymisp/api.py index 5a1285f..92004d9 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -1032,6 +1032,14 @@ class PyMISP(object): query = {"comment": comment} return self.__query('edit/{}'.format(attribute_uuid), query, controller='attributes') + def change_disable_correlation(self, attribute_uuid, disable_correlation): + """Change the disable_correlation flag""" + possible_values = [0, 1, False, True] + if disable_correlation not in possible_values: + raise Exception('disable_correlation can only be in {}'.format(', '.join(possible_values))) + query = {"disable_correlation": disable_correlation} + return self.__query('edit/{}'.format(attribute_uuid), query, controller='attributes') + # ############################## # ###### Attribute update ###### # ############################## diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index cec8b52..9ec2ca8 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -703,6 +703,10 @@ class TestComprehensive(unittest.TestCase): self.assertEqual(attribute.comment, 'This is the modified comment') attribute = self.user_misp_connector.change_comment(first.attributes[0].uuid, 'This is the modified comment, again') self.assertEqual(attribute['Attribute']['comment'], 'This is the modified comment, again') + attribute = self.user_misp_connector.change_disable_correlation(first.attributes[0].uuid, True) + self.assertEqual(attribute['Attribute']['disable_correlation'], True) + attribute = self.user_misp_connector.change_disable_correlation(first.attributes[0].uuid, 0) + self.assertEqual(attribute['Attribute']['disable_correlation'], False) finally: # Delete event self.admin_misp_connector.delete_event(first.id)