summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/tests/unit/resources/test_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/tests/unit/resources/test_base.py')
-rw-r--r--testapi/opnfv_testapi/tests/unit/resources/test_base.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/testapi/opnfv_testapi/tests/unit/resources/test_base.py b/testapi/opnfv_testapi/tests/unit/resources/test_base.py
index 6e4d454..67831f5 100644
--- a/testapi/opnfv_testapi/tests/unit/resources/test_base.py
+++ b/testapi/opnfv_testapi/tests/unit/resources/test_base.py
@@ -12,13 +12,9 @@ from os import path
import mock
from tornado import testing
-from opnfv_testapi.common import config
from opnfv_testapi.resources import models
from opnfv_testapi.tests.unit import fake_pymongo
-config.Config.CONFIG = path.join(path.dirname(__file__),
- '../../../../etc/config.ini')
-
class TestBase(testing.AsyncHTTPTestCase):
headers = {'Content-Type': 'application/json; charset=UTF-8'}
@@ -37,17 +33,22 @@ class TestBase(testing.AsyncHTTPTestCase):
def tearDown(self):
self.db_patcher.stop()
+ self.config_patcher.stop()
def _patch_server(self):
- from opnfv_testapi.cmd import server
- server.parse_config([
- '--config-file',
- path.join(path.dirname(__file__), path.pardir, 'common/normal.ini')
- ])
+ import argparse
+ config = path.join(path.dirname(__file__), '../common/normal.ini')
+ self.config_patcher = mock.patch(
+ 'argparse.ArgumentParser.parse_known_args',
+ return_value=(argparse.Namespace(config_file=config), None))
self.db_patcher = mock.patch('opnfv_testapi.cmd.server.get_db',
self._fake_pymongo)
+ self.config_patcher.start()
self.db_patcher.start()
+ def set_config_file(self):
+ self.config_file = 'normal.ini'
+
@staticmethod
def _fake_pymongo():
return fake_pymongo