Skip to content

Commit

Permalink
Merge pull request #36 from 3c7/develop
Browse files Browse the repository at this point in the history
Use StringIO.StringIO() with python2
  • Loading branch information
nadouani authored Apr 7, 2017
2 parents b1fe05f + 99f6147 commit af07fb4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions contrib/tests/suite.py → contrib/tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
import sys
import json
import unittest
from io import StringIO
from io import open

from io import open
from cortexutils.analyzer import Analyzer

# Different lib when using python3 or 2
if sys.version_info >= (3, 0):
from io import StringIO
else:
from StringIO import StringIO


def load_test_fixture(fixture_path):
path = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -19,6 +24,7 @@ def load_test_fixture(fixture_path):
sys.stdin = StringIO(input)
sys.stdout = StringIO()


class TestMinimalConfig(unittest.TestCase):

def setUp(self):
Expand All @@ -41,6 +47,7 @@ def test_params_data(self):
self.assertEqual(self.analyzer.getParam('data'), "1.1.1.1")
self.assertEqual(self.analyzer.get_param('data'), "1.1.1.1")


class TestProxyConfig(unittest.TestCase):

def setUp(self):
Expand All @@ -56,6 +63,7 @@ def test_proxy_config(self):
self.assertEqual(os.environ['http_proxy'], proxy_url)
self.assertEqual(os.environ['https_proxy'], proxy_url)


class TestTlpConfig(unittest.TestCase):

def setUp(self):
Expand Down Expand Up @@ -87,6 +95,7 @@ def test_check_tlp_ok(self):
# __check_tlp
self.assertEqual(self.analyzer._Analyzer__check_tlp(), True)


class TestErrorResponse(unittest.TestCase):

def setUp(self):
Expand Down Expand Up @@ -116,6 +125,7 @@ def test_error_response(self):
self.assertEqual(json_output['input']['config']['apikey'], 'REMOVED')
self.assertEqual(json_output['input']['config']['api_key'], 'REMOVED')


class TestReportResponse(unittest.TestCase):

def setUp(self):
Expand Down

0 comments on commit af07fb4

Please sign in to comment.