mirror of https://github.com/MISP/PyMISP
new: Add few tests for admin tasks
parent
7a5945a5ce
commit
0cedf960e9
|
@ -50,6 +50,8 @@ class TestComprehensive(unittest.TestCase):
|
||||||
cls.maxDiff = None
|
cls.maxDiff = None
|
||||||
# Connect as admin
|
# Connect as admin
|
||||||
cls.admin_misp_connector = ExpandedPyMISP(url, key, verifycert, debug=False)
|
cls.admin_misp_connector = ExpandedPyMISP(url, key, verifycert, debug=False)
|
||||||
|
r = cls.admin_misp_connector.update_misp()
|
||||||
|
print(r)
|
||||||
# Creates an org
|
# Creates an org
|
||||||
organisation = MISPOrganisation()
|
organisation = MISPOrganisation()
|
||||||
organisation.name = 'Test Org'
|
organisation.name = 'Test Org'
|
||||||
|
@ -143,6 +145,33 @@ class TestComprehensive(unittest.TestCase):
|
||||||
second = self.user_misp_connector.add_event(second_event)
|
second = self.user_misp_connector.add_event(second_event)
|
||||||
return first, second, third
|
return first, second, third
|
||||||
|
|
||||||
|
def test_server_settings(self):
|
||||||
|
settings = self.admin_misp_connector.server_settings()
|
||||||
|
for final_setting in settings['finalSettings']:
|
||||||
|
if final_setting['setting'] == 'MISP.max_correlations_per_event':
|
||||||
|
self.assertEqual(final_setting['value'], 5000)
|
||||||
|
break
|
||||||
|
self.admin_misp_connector.set_server_setting('MISP.max_correlations_per_event', 10)
|
||||||
|
settings = self.admin_misp_connector.server_settings()
|
||||||
|
for final_setting in settings['finalSettings']:
|
||||||
|
if final_setting['setting'] == 'MISP.max_correlations_per_event':
|
||||||
|
self.assertEqual(final_setting['value'], 10)
|
||||||
|
break
|
||||||
|
self.admin_misp_connector.set_server_setting('MISP.max_correlations_per_event', 5000)
|
||||||
|
|
||||||
|
settings = self.admin_misp_connector.server_settings()
|
||||||
|
for final_setting in settings['finalSettings']:
|
||||||
|
if final_setting['setting'] == 'MISP.live':
|
||||||
|
self.assertTrue(final_setting['value'])
|
||||||
|
break
|
||||||
|
self.admin_misp_connector.set_server_setting('MISP.live', False, force=True)
|
||||||
|
settings = self.admin_misp_connector.server_settings()
|
||||||
|
for final_setting in settings['finalSettings']:
|
||||||
|
if final_setting['setting'] == 'MISP.live':
|
||||||
|
self.assertFalse(final_setting['value'])
|
||||||
|
break
|
||||||
|
self.admin_misp_connector.set_server_setting('MISP.live', True, force=True)
|
||||||
|
|
||||||
def test_search_value_event(self):
|
def test_search_value_event(self):
|
||||||
'''Search a value on the event controller
|
'''Search a value on the event controller
|
||||||
* Test ACL admin user vs normal user in an other org
|
* Test ACL admin user vs normal user in an other org
|
||||||
|
|
Loading…
Reference in New Issue