Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Remove sys.path from http test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnbus committed Aug 7, 2019
1 parent a04c49b commit 418968a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion tests/http_test_suite.py
@@ -1,6 +1,6 @@
from webtest import TestApp

from unit_test_suite import UnitTestSuite
from tests.unit_test_suite import UnitTestSuite


class HTTPTestSuite(UnitTestSuite):
Expand Down
8 changes: 3 additions & 5 deletions tests/loginput/loginput_test_suite.py
@@ -1,13 +1,11 @@
import sys
import os

from mozdef_util.utilities.dot_dict import DotDict

import mock
from configlib import OptionParser

sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from http_test_suite import HTTPTestSuite
from tests.http_test_suite import HTTPTestSuite


class LoginputTestSuite(HTTPTestSuite):
Expand All @@ -16,6 +14,6 @@ def setup(self):
sample_config = DotDict()
sample_config.configfile = os.path.join(os.path.dirname(__file__), 'index.conf')
OptionParser.parse_args = mock.Mock(return_value=(sample_config, {}))
from loginput import index
self.application = index.application
from loginput import index as loginput_index
self.application = loginput_index.application
super(LoginputTestSuite, self).setup()
18 changes: 5 additions & 13 deletions tests/rest/rest_test_suite.py
@@ -1,14 +1,10 @@
import sys
import os

sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from http_test_suite import HTTPTestSuite
import mock
from configlib import OptionParser

from mozdef_util.utilities.dot_dict import DotDict

import mock
from configlib import OptionParser
import importlib
from tests.http_test_suite import HTTPTestSuite


class RestTestDict(DotDict):
Expand All @@ -24,10 +20,6 @@ def setup(self):
sample_config.configfile = os.path.join(os.path.dirname(__file__), 'index.conf')
OptionParser.parse_args = mock.Mock(return_value=(sample_config, {}))

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../rest"))
import plugins
importlib.reload(plugins)
from rest import index

self.application = index.application
from rest import index as rest_index
self.application = rest_index.application
super(RestTestSuite, self).setup()
2 changes: 1 addition & 1 deletion tests/unit_test_suite.py
Expand Up @@ -13,7 +13,7 @@

from mozdef_util.utilities import toUTC

from suite_helper import parse_config_file, parse_mapping_file, setup_es_client, setup_rabbitmq_client
from tests.suite_helper import parse_config_file, parse_mapping_file, setup_es_client, setup_rabbitmq_client


class UnitTestSuite(object):
Expand Down

0 comments on commit 418968a

Please sign in to comment.