From 3f7ee7c1a2e4e03086b8c126d8ea42bd47354b14 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Tue, 17 Dec 2019 15:19:29 +0100 Subject: [PATCH] add: Test cases for reworked passive dns and ssl modules --- tests/test_expansions.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/test_expansions.py b/tests/test_expansions.py index 4b28bd1..5fab92f 100644 --- a/tests/test_expansions.py +++ b/tests/test_expansions.py @@ -93,6 +93,40 @@ class TestExpansions(unittest.TestCase): response = self.misp_modules_post(query) self.assertEqual(self.get_values(response), '1es14c7qlb5cyhlmuekctxlgc1fv2ti9da fraudolent bitcoin address') + def test_circl_passivedns(self): + module_name = "circl_passivedns" + 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), 'passive-dns') + except Exception: + self.assertTrue(self.get_errors(response).startswith('There is an authentication error')) + else: + self.assertTrue(self.get_errors(response).startswith('CIRCL Passive DNS authentication is incomplete')) + + def test_circl_passivessl(self): + module_name = "circl_passivessl" + query = {"module": module_name, + "attribute": {"type": "", + "value": "", + "uuid": ""}, + "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), 'x509') + except Exception: + self.assertTrue(self.get_errors(response).startswith('There is an authentication error')) + else: + self.assertTrue(self.get_errors(response).startswith('CIRCL Passive SSL authentication is incomplete')) + def test_countrycode(self): query = {"module": "countrycode", "domain": "www.circl.lu"} response = self.misp_modules_post(query)