diff options
Diffstat (limited to 'vnftest/tests/unit')
-rw-r--r-- | vnftest/tests/unit/common/test_utils.py | 5 | ||||
-rwxr-xr-x | vnftest/tests/unit/core/test_commands.py | 15 | ||||
-rw-r--r-- | vnftest/tests/unit/core/test_testcase.py | 2 | ||||
-rw-r--r-- | vnftest/tests/unit/onap/test_rest_call.py (renamed from vnftest/tests/unit/onap/test_onap_api_call.py) | 12 |
4 files changed, 15 insertions, 19 deletions
diff --git a/vnftest/tests/unit/common/test_utils.py b/vnftest/tests/unit/common/test_utils.py index e8860cb..d152a98 100644 --- a/vnftest/tests/unit/common/test_utils.py +++ b/vnftest/tests/unit/common/test_utils.py @@ -28,6 +28,7 @@ import unittest import vnftest from vnftest import ssh from vnftest.common import utils +from vnftest.common import import_utils from vnftest.common import constants @@ -62,7 +63,7 @@ class ImportModulesFromPackageTestCase(unittest.TestCase): (os.path.join(vnftest_root, 'foo', 'bar'), [], ['baz.txt', 'qux.rst']) ]) - utils.import_modules_from_package('foo.bar') + import_utils.import_modules_from_package('foo.bar') @mock.patch('vnftest.common.utils.os.walk') @mock.patch.object(importlib, 'import_module') @@ -73,7 +74,7 @@ class ImportModulesFromPackageTestCase(unittest.TestCase): (os.path.join(vnftest_root, 'foo', os.pardir, 'bar'), [], ['baz.py']) ]) - utils.import_modules_from_package('foo.bar') + import_utils.import_modules_from_package('foo.bar') mock_import_module.assert_called_once_with('bar.baz') diff --git a/vnftest/tests/unit/core/test_commands.py b/vnftest/tests/unit/core/test_commands.py index 35660bd..fee15a3 100755 --- a/vnftest/tests/unit/core/test_commands.py +++ b/vnftest/tests/unit/core/test_commands.py @@ -14,18 +14,15 @@ # vnftest comment: this is a modified copy of # yardstick/tests/functional/test_cli_runner.py +import sys import unittest +from cStringIO import StringIO from vnftest.cmd.commands.runner import RunnerCommands from vnftest.cmd.commands.step import StepCommands from vnftest.core import Param from vnftest.core.runner import Runners from vnftest.core.step import Steps -from vnftest.runners.iteration import IterationRunner -from vnftest.runners.duration import DurationRunner -from vnftest.onap.onap_api_call import OnapApiCall -from cStringIO import StringIO -import sys class Capture(list): @@ -56,7 +53,7 @@ class CommandsTestCase(unittest.TestCase): step_cmd = StepCommands() with Capture() as output: step_cmd.do_list(None) - self.assert_text_in_lines(output, ["OnapApiCall"]) + self.assert_text_in_lines(output, ["RestCall"]) def test_runner_show_Duration(self): param = Param({}) @@ -72,12 +69,12 @@ class CommandsTestCase(unittest.TestCase): Runners().show(param) self.assert_text_in_lines(output, ["iterations - amount of times"]) - def test_step_show_OnapApiCall(self): + def test_step_show_RestCall(self): param = Param({}) - setattr(param, 'type', ['OnapApiCall']) + setattr(param, 'type', ['RestCall']) with Capture() as output: Steps().show(param) - self.assert_text_in_lines(output, ["Call ONAP API"]) + self.assert_text_in_lines(output, ["Call REST API"]) def assert_text_in_lines(self, lines, texts): for text in texts: diff --git a/vnftest/tests/unit/core/test_testcase.py b/vnftest/tests/unit/core/test_testcase.py index 0ba4873..5b1146d 100644 --- a/vnftest/tests/unit/core/test_testcase.py +++ b/vnftest/tests/unit/core/test_testcase.py @@ -23,7 +23,7 @@ from vnftest.core import testcase class Arg(object): def __init__(self): - self.casename = ('onap_vnftest_tc001',) + self.casename = ('onap_vnftest_onboard-v1',) class TestcaseUT(unittest.TestCase): diff --git a/vnftest/tests/unit/onap/test_onap_api_call.py b/vnftest/tests/unit/onap/test_rest_call.py index 2b6d79d..ec3c88f 100644 --- a/vnftest/tests/unit/onap/test_onap_api_call.py +++ b/vnftest/tests/unit/onap/test_rest_call.py @@ -14,16 +14,14 @@ import mock import testtools - from vnftest.contexts.base import Context from vnftest.core import task -from vnftest.onap.onap_api_call import OnapApiCall -class OnapApiCallTestCase(testtools.TestCase): +class RestCallTestCase(testtools.TestCase): step = { - 'type': 'OnapApiCall', + 'type': 'RestCall', 'options': { 'file': "dummy.yaml", 'input': @@ -46,9 +44,9 @@ class OnapApiCallTestCase(testtools.TestCase): NAME = 'sample' def setUp(self): - super(OnapApiCallTestCase, self).setUp() + super(RestCallTestCase, self).setUp() - @mock.patch('vnftest.onap.onap_api_call.OnapApiCall.execute_operation_impl') + @mock.patch('vnftest.steps.rest_call.RestCall.execute_operation_impl') def test_run(self, mock_execute_operation): mock_execute_operation.return_value = {'body': {'value': 'output1'}} t = task.Task() @@ -56,5 +54,5 @@ class OnapApiCallTestCase(testtools.TestCase): context = Context.get("CSAR") context.init(context_cfg) t.context = context - output = t._run([OnapApiCallTestCase.step], False, "vnftest.out") + output = t._run([RestCallTestCase.step], False, "vnftest.out") self.assertEquals(output[0]['data']['output1'], 'output1') |