mirror of https://github.com/MISP/PyMISP
chg: Add a way to check if the ACL is up-to-date
parent
20987f7f0f
commit
9a2b82a2ae
|
@ -131,6 +131,11 @@ class PyMISP(object):
|
|||
self.category_type_mapping = self.describe_types['category_type_mappings']
|
||||
self.sane_default = self.describe_types['sane_defaults']
|
||||
|
||||
def get_live_query_acl(self):
|
||||
"""This should return an empty list, unless the ACL is outdated."""
|
||||
response = self.__prepare_request('GET', urljoin(self.root_url, 'events/queryACL.json'))
|
||||
return self._check_response(response)
|
||||
|
||||
def get_live_describe_types(self):
|
||||
response = self.__prepare_request('GET', urljoin(self.root_url, 'attributes/describeTypes.json'))
|
||||
describe_types = self._check_response(response)
|
||||
|
|
|
@ -282,6 +282,10 @@ class TestBasic(unittest.TestCase):
|
|||
self.assertTrue(sd['to_ids'] in [0, 1])
|
||||
self.assertTrue(sd['default_category'] in categories)
|
||||
|
||||
def test_live_acl(self):
|
||||
query_acl = self.misp.get_live_query_acl()
|
||||
self.assertEqual(query_acl, [])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue