From 0d3e61dc4d82ad74c7df32bde9436defd5697d15 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Wed, 18 Dec 2019 23:04:36 +0100 Subject: [PATCH] add: [tests] Test case for the APIVoid module --- tests/test_expansions.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_expansions.py b/tests/test_expansions.py index 79aa401..93ee69d 100644 --- a/tests/test_expansions.py +++ b/tests/test_expansions.py @@ -78,6 +78,24 @@ class TestExpansions(unittest.TestCase): except AssertionError: self.assertTrue(self.get_values(response).startswith('185.255.79.90 IS NOT listed by OSINT.digitalside.it.')) + def test_apivoid(self): + module_name = "apivoid" + query = {"module": module_name, + "attribute": {"type": "domain", + "value": "circl.lu", + "uuid": "ea89a33b-4ab7-4515-9f02-922a0bee333d"}, + "config": {}} + if module_name in self.configs: + query['config'] = self.configs[module_name] + response = self.misp_modules_post(query) + try: + self.assertEqual(self.get_object(response), 'dns-record') + except Exception: + self.assertTrue(self.get_errors(response).startswith('You do not have enough APIVoid credits')) + else: + response = self.misp_modules_post(query) + self.assertEqual(self.get_errors(response), 'An API key for APIVoid is required.') + def test_bgpranking(self): query = {"module": "bgpranking", "AS": "13335"} response = self.misp_modules_post(query)