mirror of https://github.com/MISP/PyMISP
Add new function PyMISP.change_disablecorrelation(attribute_uuid,disable_correlation) to be able to enable/disable correlation on attributes.
parent
b8759673b9
commit
e91d4a7d2d
|
@ -1032,6 +1032,13 @@ class PyMISP(object):
|
||||||
query = {"comment": comment}
|
query = {"comment": comment}
|
||||||
return self.__query('edit/{}'.format(attribute_uuid), query, controller='attributes')
|
return self.__query('edit/{}'.format(attribute_uuid), query, controller='attributes')
|
||||||
|
|
||||||
|
def change_disablecorrelation(self, attribute_uuid, disable_correlation):
|
||||||
|
"""Change the disable_correlation flag"""
|
||||||
|
if disable_correlation not in [0, 1]:
|
||||||
|
raise Exception('disable_correlation can only be 0 or 1')
|
||||||
|
query = {"disable_correlation": disable_correlation}
|
||||||
|
return self.__query('edit/{}'.format(attribute_uuid), query, controller='attributes')
|
||||||
|
|
||||||
# ##############################
|
# ##############################
|
||||||
# ###### Attribute update ######
|
# ###### Attribute update ######
|
||||||
# ##############################
|
# ##############################
|
||||||
|
|
|
@ -409,6 +409,20 @@ class TestOffline(unittest.TestCase):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def test_change_disablecorrelation(self, m):
|
||||||
|
self.initURI(m)
|
||||||
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
|
self.assertEqual({}, pymisp.change_disable_correlation(self.key, 1))
|
||||||
|
|
||||||
|
def test_change_disablecorrelation_invalid(self, m):
|
||||||
|
self.initURI(m)
|
||||||
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
|
try:
|
||||||
|
pymisp.change_disablecorrelation(self.key, 42)
|
||||||
|
self.assertFalse('Exception required for off domain value')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
def test_proposal_view_default(self, m):
|
def test_proposal_view_default(self, m):
|
||||||
self.initURI(m)
|
self.initURI(m)
|
||||||
pymisp = PyMISP(self.domain, self.key)
|
pymisp = PyMISP(self.domain, self.key)
|
||||||
|
|
Loading…
Reference in New Issue