Remove duplicate app loading

Testing app has be and should be loaded in the FunctionalTest class.
So we should remove the duplicate app loading in the TestCase class.

The config.py file is not used if we remove the duplicate app
loading.So let's remove it.

If we remove the duplicate app loading, TestContainerController
should be modified. The base class of it should be FunctionalTest.

By the way, rename path_get to get_path.

Change-Id: I93d69d9392ecb8ae0303efe14574a6ebe9a82b3c
Closes-Bug: #1478194
This commit is contained in:
Hua Wang 2015-07-18 03:46:01 +08:00
parent 16688d42a7
commit 0b24a43ed4
4 changed files with 4 additions and 49 deletions

View File

@ -23,7 +23,6 @@ from oslo_config import cfg
from oslo_log import log
from oslotest import base
import pecan
from pecan import testing
import testscenarios
from magnum.common import context as magnum_context
@ -50,10 +49,6 @@ class TestCase(base.BaseTestCase):
def setUp(self):
super(TestCase, self).setUp()
self.app = testing.load_test_app(os.path.join(
os.path.dirname(__file__),
'config.py'
))
token_info = {
'token': {
'project': {
@ -108,7 +103,7 @@ class TestCase(base.BaseTestCase):
for k, v in kw.items():
CONF.set_override(k, v, group)
def path_get(self, project_file=None):
def get_path(self, project_file=None):
"""Get the absolute path to a file. Used for testing the API.
:param project_file: File whose path to return. Default: None.

View File

@ -1,40 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from magnum.api import hooks
# Server Specific Configurations
server = {
'port': '8080',
'host': '0.0.0.0'
}
# Pecan Application Configurations
app = {
'root': 'magnum.api.controllers.root.RootController',
'modules': ['magnum.api'],
'debug': True,
'hooks': [
hooks.ContextHook(),
hooks.RPCHook()
],
'acl_public_routes': [
'/'
],
}
# Custom Configurations must be in Python dictionary format::
#
# foo = {'bar':'baz'}
#
# All configurations are accessible at::
# pecan.conf

View File

@ -57,7 +57,7 @@ class FunctionalTest(base.DbTestCase):
def _make_app(self, enable_acl=False):
# Determine where we are so we can set up paths in the config
root_dir = self.path_get()
root_dir = self.get_path()
self.config = {
'app': {

View File

@ -11,7 +11,7 @@
# limitations under the License.
from magnum import objects
from magnum.tests.unit.db import base as db_base
from magnum.tests.unit.api import base as api_base
from magnum.tests.unit.db import utils
import mock
@ -19,7 +19,7 @@ from mock import patch
from webtest.app import AppError
class TestContainerController(db_base.DbTestCase):
class TestContainerController(api_base.FunctionalTest):
def setUp(self):
super(TestContainerController, self).setUp()
p = patch('magnum.objects.Bay.get_by_uuid')