new: tests for update modules

pull/282/head
Raphaël Vinot 2018-09-29 15:44:02 -04:00
parent c838ea95dd
commit c08deb95b6
2 changed files with 23 additions and 1 deletions

View File

@ -92,7 +92,7 @@ class ExpandedPyMISP(PyMISP):
response = response.json()
if logger.isEnabledFor(logging.DEBUG):
logger.debug(response)
if response.get('response') is not None:
if isinstance(response, dict) and response.get('response') is not None:
# Cleanup.
return response.get('response')
return response

View File

@ -748,6 +748,28 @@ class TestComprehensive(unittest.TestCase):
self.admin_misp_connector.delete_event(second.id)
self.admin_misp_connector.delete_event(third.id)
def test_update_modules(self):
# warninglist
self.admin_misp_connector.update_warninglists()
r = self.admin_misp_connector.update_warninglists()
self.assertEqual(r['name'], 'All warninglists are up to date already.')
# taxonomies
self.admin_misp_connector.update_taxonomies()
r = self.admin_misp_connector.update_taxonomies()
self.assertEqual(r['name'], 'All taxonomy libraries are up to date already.')
# object templates
self.admin_misp_connector.update_object_templates()
r = self.admin_misp_connector.update_object_templates()
self.assertEqual(type(r), list)
# notice lists
self.admin_misp_connector.update_noticelists()
r = self.admin_misp_connector.update_noticelists()
self.assertEqual(r['name'], 'All noticelists are up to date already.')
# galaxies
self.admin_misp_connector.update_galaxies()
r = self.admin_misp_connector.update_galaxies()
self.assertEqual(r['name'], 'Galaxies updated.')
@unittest.skip("Currently failing")
def test_search_type_event_csv(self):
try: