Skip to content

Commit

Permalink
new: tests for update modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Sep 29, 2018
1 parent c838ea9 commit c08deb9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pymisp/aping.py
Expand Up @@ -92,7 +92,7 @@ def _check_response(self, response):
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
Expand Down
22 changes: 22 additions & 0 deletions tests/testlive_comprehensive.py
Expand Up @@ -748,6 +748,28 @@ def test_upload_sample(self):
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:
Expand Down

0 comments on commit c08deb9

Please sign in to comment.