add: Xforce Exchange module tests

chrisr3d 2019-11-05 17:13:34 +01:00
parent 0fd3f92fe3
commit 9068725322
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 23 additions and 0 deletions

View File

@ -490,6 +490,29 @@ class TestExpansions(unittest.TestCase):
except Exception:
self.assertEqual(self.get_values(response), 'No additional data found on Wikidata')
def test_xforceexchange(self):
module_name = "xforceexchange"
query_types = ('domain', 'ip-src', 'md5', 'url', 'vulnerability')
query_values = ('', '', '474b9ccf5ab9d72ca8a333889bbb34f0',
'', 'CVE-2014-2601')
results = ('domain-ip', 'domain-ip', 'url', 'domain-ip', 'vulnerability')
if module_name in self.configs:
for query_type, query_value, result in zip(query_types, query_values, results):
query = {"module": module_name,
"attribute": {"type": query_type,
"value": query_value,
"uuid": "ea89a33b-4ab7-4515-9f02-922a0bee333d"},
"config": self.configs[module_name]}
response = self.misp_modules_post(query)
self.assertEqual(self.get_object(response), result)
query = {"module": module_name,
"attribute": {"type": query_types[0],
"value": query_values[0],
"uuid": "ea89a33b-4ab7-4515-9f02-922a0bee333d"}}
response = self.misp_modules_post(query)
self.assertEqual(self.get_errors(response), "An API authentication is required (key and password).")
def test_xlsx(self):
filename = 'test.xlsx'
with open(f'{self.dirname}/test_files/{filename}', 'rb') as f: