Move integration tests under mistralclient/tests folder

- Collect all tests in one folder 'mistralclient/tests'.
- Create new folder 'functional' in the mistralclient/tests for integration functional tests.
- Restructure tests, create folder 'v1' for current tests (version 1).
- Create new folder 'unit' in the mistralclient/tests and put all unit tests here.
- Correct imports in the file with unit tests.

Change-Id: If92c11640d7cb61ee8ffcdc7ba99d7ab1061afa7
This commit is contained in:
Anastasia Kuznetsova
2014-08-07 18:36:19 +04:00
parent 717d81d252
commit b0d0c31361
20 changed files with 13 additions and 16 deletions

View File

@@ -28,4 +28,4 @@ TEMPEST_DIR=${TEMPEST_DIR:-/opt/stack/new/tempest}
# Add tempest source tree to PYTHONPATH # Add tempest source tree to PYTHONPATH
export PYTHONPATH=$PYTHONPATH:$TEMPEST_DIR export PYTHONPATH=$PYTHONPATH:$TEMPEST_DIR
nosetests -sv functionaltests nosetests -sv mistralclient/tests/functional/

View File

@@ -25,11 +25,8 @@ class MistralBase(testtools.TestCase):
mgr = clients.Manager() mgr = clients.Manager()
cls.mistral_client = ClientAuth(mgr.auth_provider).mistral_client cls.mistral_client = ClientAuth(mgr.auth_provider).mistral_client
__location = os.path.realpath(os.path.join(os.getcwd(), cls.definition = open(os.path.relpath(
os.path.dirname(__file__))) 'functionaltests/hello.yaml', os.getcwd()), 'rb').read()
cls.definition = open(os.path.join(
__location, 'hello.yaml'), 'rb').read()
cls.wb = cls.mistral_client.workbooks.create( cls.wb = cls.mistral_client.workbooks.create(
"wb", "Description", ["tags"]) "wb", "Description", ["tags"])

View File

View File

@@ -18,7 +18,7 @@ import pkg_resources as pkg
import mock import mock
from mistralclient.tests import base from mistralclient.tests.unit import base
from mistralclient.commands import executions from mistralclient.commands import executions
from mistralclient.api.executions import Execution from mistralclient.api.executions import Execution
@@ -44,7 +44,7 @@ class TestCLIExecutions(base.BaseCommandTest):
def test_create_ctx_file(self, mock): def test_create_ctx_file(self, mock):
mock.return_value = EXECUTION mock.return_value = EXECUTION
path = pkg.resource_filename('mistralclient', path = pkg.resource_filename('mistralclient',
'tests/resources/ctx.json') 'tests/unit/resources/ctx.json')
result = self.call(executions.Create, result = self.call(executions.Create,
app_args=['name', 'id', path]) app_args=['name', 'id', path])

View File

@@ -16,7 +16,7 @@
import mock import mock
from mistralclient.tests import base from mistralclient.tests.unit import base
from mistralclient.commands import tasks from mistralclient.commands import tasks
from mistralclient.api.tasks import Task from mistralclient.api.tasks import Task

View File

@@ -16,7 +16,7 @@
import mock import mock
from mistralclient.tests import base from mistralclient.tests.unit import base
from mistralclient.commands import workbooks from mistralclient.commands import workbooks
from mistralclient.api.workbooks import Workbook from mistralclient.api.workbooks import Workbook

View File

@@ -15,7 +15,7 @@
import unittest2 import unittest2
import json import json
from mistralclient.tests import base from mistralclient.tests.unit import base
from mistralclient.api.executions import Execution from mistralclient.api.executions import Execution
# TODO: Later we need additional tests verifying all the errors etc. # TODO: Later we need additional tests verifying all the errors etc.

View File

@@ -14,7 +14,7 @@
import json import json
from mistralclient.tests import base from mistralclient.tests.unit import base
from mistralclient.api.listeners import Listener from mistralclient.api.listeners import Listener
# TODO: later we need additional tests verifying all the errors etc. # TODO: later we need additional tests verifying all the errors etc.

View File

@@ -14,7 +14,7 @@
import json import json
from mistralclient.tests import base from mistralclient.tests.unit import base
from mistralclient.api.tasks import Task from mistralclient.api.tasks import Task
# TODO: later we need additional tests verifying all the errors etc. # TODO: later we need additional tests verifying all the errors etc.

View File

@@ -14,7 +14,7 @@
import json import json
from mistralclient.tests import base from mistralclient.tests.unit import base
from mistralclient.api.workbooks import Workbook from mistralclient.api.workbooks import Workbook
# TODO: later we need additional tests verifying all the errors etc. # TODO: later we need additional tests verifying all the errors etc.

View File

@@ -15,11 +15,11 @@ setenv =
NOSE_OPENSTACK_SHOW_ELAPSED=1 NOSE_OPENSTACK_SHOW_ELAPSED=1
NOSE_OPENSTACK_STDOUT=1 NOSE_OPENSTACK_STDOUT=1
NOSE_XUNIT=1 NOSE_XUNIT=1
DISCOVER_DIRECTORY=mistralclient/tests DISCOVER_DIRECTORY=mistralclient/tests/unit
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = nosetests mistralclient/tests commands = nosetests mistralclient/tests/unit
[testenv:pep8] [testenv:pep8]
commands = flake8 {posargs} commands = flake8 {posargs}