Skip to content

Commit

Permalink
Small change + make pep8 happy + rename suite->test_suite for pytest …
Browse files Browse the repository at this point in the history
…compatibility.
  • Loading branch information
3c7 committed Apr 7, 2017
1 parent bb31eba commit 99f6147
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contrib/tests/suite.py → contrib/tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
from cortexutils.analyzer import Analyzer

# Different lib when using python3 or 2
if sys.version_info > (2, 8):
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__))
fixture_file = open(path + '/' + fixture_path)
Expand All @@ -25,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 @@ -47,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 @@ -62,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 @@ -93,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 @@ -122,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 99f6147

Please sign in to comment.