Small change + make pep8 happy + rename suite->test_suite for pytest compatibility.

This commit is contained in:
3c7 2017-04-07 09:15:08 +02:00
parent bb31eba28a
commit 99f61474c0

View File

@ -10,13 +10,12 @@ from io import open
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)
@ -25,6 +24,7 @@ def load_test_fixture(fixture_path):
sys.stdin = StringIO(input)
sys.stdout = StringIO()
class TestMinimalConfig(unittest.TestCase):
def setUp(self):
@ -47,6 +47,7 @@ class TestMinimalConfig(unittest.TestCase):
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):
@ -62,6 +63,7 @@ class TestProxyConfig(unittest.TestCase):
self.assertEqual(os.environ['http_proxy'], proxy_url)
self.assertEqual(os.environ['https_proxy'], proxy_url)
class TestTlpConfig(unittest.TestCase):
def setUp(self):
@ -93,6 +95,7 @@ class TestTlpConfig(unittest.TestCase):
# __check_tlp
self.assertEqual(self.analyzer._Analyzer__check_tlp(), True)
class TestErrorResponse(unittest.TestCase):
def setUp(self):
@ -122,6 +125,7 @@ class TestErrorResponse(unittest.TestCase):
self.assertEqual(json_output['input']['config']['apikey'], 'REMOVED')
self.assertEqual(json_output['input']['config']['api_key'], 'REMOVED')
class TestReportResponse(unittest.TestCase):
def setUp(self):