Modules for expansion services, import and export in MISP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
import requests
import base64
import json
import os
class TestModules(unittest.TestCase):
def setUp(self):
self.maxDiff = None
self.headers = {'Content-Type': 'application/json'}
self.url = ""
def test_introspection(self):
response = requests.get(self.url + "modules")
def test_cve(self):
with open('tests/bodycve.json', 'r') as f:
response = + "query",
def test_dns(self):
with open('tests/body.json', 'r') as f:
response = + "query",
with open('tests/body_timeout.json', 'r') as f:
response = + "query",
def test_stix(self):
with open("tests/stix.xml", "rb") as f:
content = base64.b64encode(
data = json.dumps({"module": "stiximport",
"data": content.decode('utf-8'),
response = + "query", data=data).json()
print("STIX :: {}".format(response))
values = [x["values"][0] for x in response["results"]]
assert("" in values)
assert("" in values)
assert("" in values)
def test_virustotal(self):
# This can't actually be tested without disclosing a private
# API key. This will attempt to run with a .gitignored keyfile
# and pass if it can't find one
if not os.path.exists("tests/bodyvirustotal.json"):
with open("tests/bodyvirustotal.json", "r") as f:
response = + "query",
if __name__ == '__main__':