From 5a97e684a6be2cbe63a74654a1a38bcaad008a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 22 Sep 2015 10:57:08 +0200 Subject: [PATCH] Move test cases to PyMISP --- .travis.yml | 33 ++++++++++++++++++--------------- tests/__init__.py | 0 tests/test.py | 19 ------------------- 3 files changed, 18 insertions(+), 34 deletions(-) delete mode 100644 tests/__init__.py delete mode 100755 tests/test.py diff --git a/.travis.yml b/.travis.yml index 710dbe9bc..44994e345 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ install: - pip install --user pyzmq - pip install --user git+https://github.com/CybOXProject/python-cybox.git@v2.1.0.12#egg=Package - pip install --user git+https://github.com/stixproject/python-stix.git@v1.2.0.0#egg=Package - - pip install --user git+https://github.com/MISP/PyMISP.git@v1.8#egg=Package + - pip install --user git+https://github.com/MISP/PyMISP.git#egg=Package - pear install Crypt_GPG - pear install Net_GeoIP - phpenv rehash @@ -67,27 +67,30 @@ before_script: - cp travis/database.php app/Config/database.php - cp travis/core.php app/Config/core.php - cp travis/config.php app/Config/config.php - - sudo chown -R www-data:www-data ./ - - sudo chmod -R 755 ./ - - sudo chmod 700 .gnupg - - sudo chmod -R 777 tests - - sudo chmod -R 777 app/tmp - - sudo chmod -R 777 app/files - - sudo chmod -R 777 app/files/scripts/tmp - mysql -u root -e 'create database misp;' - mysql -u root -e "grant usage on *.* to misp@localhost identified by 'blah'"; - mysql -u root -e "grant all privileges on misp.* to misp@localhost;" - mysql -u misp -pblah misp < INSTALL/MYSQL.sql - -script: + - git clone https://github.com/MISP/PyMISP.git - AUTH=`app/Console/cake userInit -q` - sudo chown -R www-data:www-data app/ - curl http://misp.local >> /dev/null - - pushd tests - - echo 'url = "http://misp.local"' >> keys.py - - echo 'key = "'${AUTH}'"' >> keys.py - - cat keys.py - - ./test.py + - pushd PyMISP + - echo 'url = "http://misp.local"' >> tests/keys.py + - echo 'key = "'${AUTH}'"' >> tests/keys.py + - cat tests/keys.py + - popd + - sudo chown -R www-data:www-data ./ + - sudo chmod -R 755 ./ + - sudo chmod 700 .gnupg + - sudo chmod -R 777 app/tmp + - sudo chmod -R 777 app/files + - sudo chmod -R 777 app/files/scripts/tmp + - sudo chmod -R 777 PyMISP + +script: + - pushd PyMISP + - python setup.py test - popd #- cat app/tmp/logs/error.log #- cat app/tmp/logs/debug.log diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/test.py b/tests/test.py deleted file mode 100755 index 6c98c24d0..000000000 --- a/tests/test.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import json -from simplejson.decoder import JSONDecodeError - -from pymisp import PyMISP -from keys import url, key - - -misp = PyMISP(url, key, True, 'json') - -try: - event = misp.new_event(0, 1, 0, "This is a test") - print(event) - print(json.dumps(event, indent=2)) -except JSONDecodeError as e: - print(e.doc) - exit(0)