From c08deb95b6d5f36ab6534343730e12f17cf5ee4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Sat, 29 Sep 2018 15:44:02 -0400 Subject: [PATCH] new: tests for update modules --- pymisp/aping.py | 2 +- tests/testlive_comprehensive.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pymisp/aping.py b/pymisp/aping.py index bf01a04..2f15d95 100644 --- a/pymisp/aping.py +++ b/pymisp/aping.py @@ -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 diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index 827d2de..e11dd16 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -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: