mirror of https://github.com/MISP/PyMISP
chg: Improve test cases
parent
4ccddeee9c
commit
f384d74049
|
@ -282,8 +282,8 @@ class TestBasic(unittest.TestCase):
|
|||
def test_describeTypes_types_in_categories(self):
|
||||
category_type_mappings = self.live_describe_types['category_type_mappings']
|
||||
for category, types in category_type_mappings.items():
|
||||
existing_types = [t for t in types if t in self.live_describe_types['types']]
|
||||
self.assertEqual(sorted(existing_types), sorted(types))
|
||||
existing_types = [t for t in types if t in self.live_describe_types['types']]
|
||||
self.assertEqual(sorted(existing_types), sorted(types))
|
||||
|
||||
def test_describeTypes_types_have_category(self):
|
||||
category_type_mappings = self.live_describe_types['category_type_mappings']
|
||||
|
@ -299,14 +299,6 @@ class TestBasic(unittest.TestCase):
|
|||
self.assertTrue(sd['to_ids'] in [0, 1])
|
||||
self.assertTrue(sd['default_category'] in categories)
|
||||
|
||||
def test_describeTypes_uptodate(self):
|
||||
local_describe = self.misp.get_local_describe_types()
|
||||
for temp_key in local_describe.keys():
|
||||
if isinstance(local_describe[temp_key], list):
|
||||
self.assertEqual(sorted(self.live_describe_types[temp_key]), sorted(local_describe[temp_key]))
|
||||
else:
|
||||
self.assertEqual(self.live_describe_types[temp_key], local_describe[temp_key])
|
||||
|
||||
def test_live_acl(self):
|
||||
query_acl = self.misp.get_live_query_acl()
|
||||
self.assertEqual(query_acl['response'], [])
|
||||
|
|
|
@ -151,17 +151,22 @@ class TestComprehensive(unittest.TestCase):
|
|||
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)
|
||||
r = self.admin_misp_connector.set_server_setting('MISP.max_correlations_per_event', 10)
|
||||
self.assertEqual(r['message'], 'Field updated', r)
|
||||
|
||||
setting = self.admin_misp_connector.get_server_setting('MISP.max_correlations_per_event')
|
||||
self.assertEqual(setting['value'], 10)
|
||||
self.admin_misp_connector.set_server_setting('MISP.max_correlations_per_event', 5000)
|
||||
r = self.admin_misp_connector.set_server_setting('MISP.max_correlations_per_event', 5000)
|
||||
self.assertEqual(r['message'], 'Field updated', r)
|
||||
|
||||
setting = self.admin_misp_connector.get_server_setting('MISP.live')
|
||||
self.assertTrue(setting['value'])
|
||||
self.admin_misp_connector.set_server_setting('MISP.live', False, force=True)
|
||||
r = self.admin_misp_connector.set_server_setting('MISP.live', False, force=True)
|
||||
self.assertEqual(r['message'], 'Field updated', r)
|
||||
setting = self.admin_misp_connector.get_server_setting('MISP.live')
|
||||
self.assertFalse(setting['value'])
|
||||
self.admin_misp_connector.set_server_setting('MISP.live', True, force=True)
|
||||
r = self.admin_misp_connector.set_server_setting('MISP.live', True, force=True)
|
||||
self.assertEqual(r['message'], 'Field updated', r)
|
||||
setting = self.admin_misp_connector.get_server_setting('MISP.live')
|
||||
self.assertTrue(setting['value'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue