From ef6e3b27f81bee3b42a0971276c5377e17323f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Sat, 18 Jun 2016 14:53:26 +0900 Subject: [PATCH] Proper testcases --- .travis.yml | 9 +++++---- tests/__init__.py | 0 tests/test.py | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tests/__init__.py create mode 100755 tests/test.py diff --git a/.travis.yml b/.travis.yml index d9d892f..abef1f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,9 +17,10 @@ python: - "nightly" install: - - pip install -r REQUIREMENTS + - python setup.py install script: - - pushd bin - - ./misp-modules.py -t - - popd + - misp-modules.py & + - sleep 15 + - python setup.py test + - pkill misp-modules.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test.py b/tests/test.py new file mode 100755 index 0000000..4732358 --- /dev/null +++ b/tests/test.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import unittest +import requests + + +class TestModules(unittest.TestCase): + + def setUp(self): + self.maxDiff = None + self.headers = {'Content-Type': 'application/json'} + + def test_introspection(self): + response = requests.get('http://127.0.0.1:6666/modules') + print(response.json()) + + def test_cve(self): + with open('tests/bodycve.json', 'r') as f: + response = requests.post('http://127.0.0.1:6666/query', data=f.read()) + print(response.json()) + + def test_dns(self): + with open('tests/body.json', 'r') as f: + response = requests.post('http://127.0.0.1:6666/query', data=f.read()) + print(response.json())