chg: Add a way to check if the ACL is up-to-date

pull/146/head
Raphaël Vinot 2017-12-01 14:35:19 +01:00
parent 20987f7f0f
commit 9a2b82a2ae
2 changed files with 9 additions and 0 deletions

View File

@ -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)

View File

@ -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()