aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/ci/test_tier_builder.py2
-rw-r--r--functest/tests/unit/core/test_feature.py134
-rw-r--r--functest/tests/unit/core/test_testcase.py92
-rw-r--r--functest/tests/unit/core/test_vnf_base.py2
-rw-r--r--functest/tests/unit/features/test_barometer.py27
-rw-r--r--functest/tests/unit/features/test_copper.py38
-rw-r--r--functest/tests/unit/features/test_doctor.py38
-rw-r--r--functest/tests/unit/features/test_domino.py38
-rw-r--r--functest/tests/unit/features/test_netready.py39
-rw-r--r--functest/tests/unit/features/test_odl_sfc.py39
-rw-r--r--functest/tests/unit/features/test_promise.py39
-rw-r--r--functest/tests/unit/features/test_sdnvpn.py39
-rw-r--r--functest/tests/unit/features/test_security_scan.py42
-rw-r--r--functest/tests/unit/odl/test_odl.py48
-rw-r--r--functest/tests/unit/openstack/__init__.py (renamed from functest/tests/unit/opnfv_tests/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/rally/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py (renamed from functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py)0
-rw-r--r--functest/tests/unit/openstack/refstack_client/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/rally/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/refstack_client/test_refstack_client.py (renamed from functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py)0
-rw-r--r--functest/tests/unit/openstack/tempest/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/refstack_client/__init__.py)0
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py (renamed from functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py)0
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py (renamed from functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py)168
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py19
-rw-r--r--functest/tests/unit/vnf/__init__.py (renamed from functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py)0
-rw-r--r--functest/tests/unit/vnf/ims/__init__.py (renamed from functest/tests/unit/opnfv_tests/vnf/__init__.py)0
-rw-r--r--functest/tests/unit/vnf/ims/test_clearwater.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_clearwater.py)0
-rw-r--r--functest/tests/unit/vnf/ims/test_cloudify_ims.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_cloudify_ims.py)0
-rw-r--r--functest/tests/unit/vnf/ims/test_ims_base.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by)6
-rw-r--r--functest/tests/unit/vnf/ims/test_orchestrator_cloudify.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_orchestrator_cloudify.py)0
-rw-r--r--functest/tests/unit/vnf/rnc/__init__.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/__init__.py)0
30 files changed, 256 insertions, 554 deletions
diff --git a/functest/tests/unit/ci/test_tier_builder.py b/functest/tests/unit/ci/test_tier_builder.py
index 48c94a57..438fa7c2 100644
--- a/functest/tests/unit/ci/test_tier_builder.py
+++ b/functest/tests/unit/ci/test_tier_builder.py
@@ -22,7 +22,7 @@ class TierBuilderTesting(unittest.TestCase):
'scenario': 'test_scenario'}
self.testcase = {'dependencies': self.dependency,
- 'name': 'test_name',
+ 'case_name': 'test_name',
'criteria': 'test_criteria',
'blocking': 'test_blocking',
'clean_flag': 'test_clean_flag',
diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py
index 0ed178a1..993da5a0 100644
--- a/functest/tests/unit/core/test_feature.py
+++ b/functest/tests/unit/core/test_feature.py
@@ -16,92 +16,82 @@ import mock
from functest.core import feature
from functest.core import testcase
-from functest.utils import constants
+# logging must be disabled else it calls time.time()
+# what will break these unit tests.
+logging.disable(logging.CRITICAL)
-class FeatureInitTesting(unittest.TestCase):
- logging.disable(logging.CRITICAL)
+class FeatureTestingBase(unittest.TestCase):
- @unittest.skip("JIRA: FUNCTEST-780")
- def test_init_with_wrong_repo(self):
- with self.assertRaises(ValueError):
- feature.Feature(repo='foo')
+ _case_name = "foo"
+ _project_name = "bar"
+ _repo = "dir_repo_copper"
+ _cmd = "cd /home/opnfv/repos/foo/tests && bash run.sh && cd -"
+ _output_file = '/home/opnfv/functest/results/bar.log'
+ feature = None
- def test_init(self):
- barometer = feature.Feature(repo='dir_repo_barometer')
- self.assertEqual(barometer.project_name, "functest")
- self.assertEqual(barometer.case_name, "")
- self.assertEqual(
- barometer.repo,
- constants.CONST.__getattribute__('dir_repo_barometer'))
+ @mock.patch('time.time', side_effect=[1, 2])
+ def _test_run(self, status, mock_method=None):
+ self.assertEqual(self.feature.run(cmd=self._cmd), status)
+ if status == testcase.TestCase.EX_OK:
+ self.assertEqual(self.feature.result, 100)
+ else:
+ self.assertEqual(self.feature.result, 0)
+ mock_method.assert_has_calls([mock.call(), mock.call()])
+ self.assertEqual(self.feature.start_time, 1)
+ self.assertEqual(self.feature.stop_time, 2)
-class FeatureTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
+class FeatureTesting(FeatureTestingBase):
def setUp(self):
- self.feature = feature.Feature(repo='dir_repo_barometer')
+ self.feature = feature.Feature(
+ project_name=self._project_name, case_name=self._case_name)
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_prepare_ko(self):
- # pylint: disable=bad-continuation
- with mock.patch.object(
- self.feature, 'prepare',
- return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_prepare_exc(self):
- with mock.patch.object(self.feature, 'prepare',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_post_ko(self):
+ def test_run_exc(self):
# pylint: disable=bad-continuation
with mock.patch.object(
- self.feature, 'post',
- return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_post_exc(self):
- with mock.patch.object(self.feature, 'post',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-778")
- def test_execute_ko(self):
- with mock.patch.object(self.feature, 'execute',
- return_value=1) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-778")
- def test_execute_exc(self):
- with mock.patch.object(self.feature, 'execute',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
+ self.feature, 'execute',
+ side_effect=Exception) as mock_method:
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(cmd=self._cmd)
def test_run(self):
- with mock.patch.object(self.feature, 'execute',
- return_value=0) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_OK)
- mock_object.assert_called_once_with()
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+
+class BashFeatureTesting(FeatureTestingBase):
+
+ def setUp(self):
+ self.feature = feature.BashFeature(
+ project_name=self._project_name, case_name=self._case_name)
+
+ @mock.patch("functest.utils.functest_utils.execute_command")
+ def test_run_no_cmd(self, mock_method=None):
+ self.assertEqual(self.feature.run(), testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_not_called()
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ return_value=1)
+ def test_run_ko(self, mock_method=None):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ side_effect=Exception)
+ def test_run_exc(self, mock_method=None):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ return_value=0)
+ def test_run(self, mock_method):
+ self._test_run(testcase.TestCase.EX_OK)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
if __name__ == "__main__":
diff --git a/functest/tests/unit/core/test_testcase.py b/functest/tests/unit/core/test_testcase.py
index 5ff41cd6..cc8446d8 100644
--- a/functest/tests/unit/core/test_testcase.py
+++ b/functest/tests/unit/core/test_testcase.py
@@ -27,13 +27,15 @@ class TestCaseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
_case_name = "base"
+ _project_name = "functest"
+ _published_result = "PASS"
def setUp(self):
- self.test = testcase.TestCase(case_name=self._case_name)
- self.test.project = "functest"
+ self.test = testcase.TestCase(case_name=self._case_name,
+ project_name=self._project_name)
self.test.start_time = "1"
self.test.stop_time = "2"
- self.test.criteria = "PASS"
+ self.test.result = 100
self.test.details = {"Hello": "World"}
def test_run_unimplemented(self):
@@ -55,10 +57,6 @@ class TestCaseTesting(unittest.TestCase):
self.test.case_name = None
self._test_missing_attribute()
- def test_missing_criteria(self):
- self.test.criteria = None
- self._test_missing_attribute()
-
def test_missing_start_time(self):
self.test.start_time = None
self._test_missing_attribute()
@@ -74,8 +72,8 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
- self.test.stop_time, self.test.criteria, self.test.details)
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, self._published_result, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
return_value=False)
@@ -83,8 +81,8 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_PUSH_TO_DB_ERROR)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
- self.test.stop_time, self.test.criteria, self.test.details)
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, self._published_result, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
return_value=True)
@@ -92,24 +90,78 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
- self.test.stop_time, self.test.criteria, self.test.details)
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, self._published_result, self.test.details)
+
+ @mock.patch('functest.utils.functest_utils.push_results_to_db',
+ return_value=True)
+ def test_push_to_db_res_ko(self, mock_function=None):
+ self.test.result = 0
+ self.assertEqual(self.test.push_to_db(),
+ testcase.TestCase.EX_OK)
+ mock_function.assert_called_once_with(
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, 'FAIL', self.test.details)
+
+ @mock.patch('functest.utils.functest_utils.push_results_to_db',
+ return_value=True)
+ def test_push_to_db_both_ko(self, mock_function=None):
+ self.test.result = 0
+ self.test.criteria = 0
+ self.assertEqual(self.test.push_to_db(),
+ testcase.TestCase.EX_OK)
+ mock_function.assert_called_once_with(
+ self._project_name, self._case_name, self.test.start_time,
+ self.test.stop_time, 'FAIL', self.test.details)
def test_check_criteria_missing(self):
self.test.criteria = None
- self.assertEqual(self.test.check_criteria(),
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
+ def test_check_result_missing(self):
+ self.test.result = None
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
+ def test_check_result_failed(self):
+ # Backward compatibility
+ # It must be removed as soon as TestCase subclasses
+ # stop setting result = 'PASS' or 'FAIL'.
+ self.test.result = 'FAIL'
+ self.assertEqual(self.test.check_result(),
testcase.TestCase.EX_TESTCASE_FAILED)
- def test_check_criteria_failed(self):
- self.test.criteria = 'FAILED'
- self.assertEqual(self.test.check_criteria(),
+ def test_check_result_pass(self):
+ # Backward compatibility
+ # It must be removed as soon as TestCase subclasses
+ # stop setting result = 'PASS' or 'FAIL'.
+ self.test.result = 'PASS'
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_OK)
+
+ def test_check_result_lt(self):
+ self.test.result = 50
+ self.assertEqual(self.test.check_result(),
testcase.TestCase.EX_TESTCASE_FAILED)
- def test_check_criteria_pass(self):
- self.test.criteria = 'PASS'
- self.assertEqual(self.test.check_criteria(),
+ def test_check_result_eq(self):
+ self.test.result = 100
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_OK)
+
+ def test_check_result_gt(self):
+ self.test.criteria = 50
+ self.test.result = 100
+ self.assertEqual(self.test.check_result(),
testcase.TestCase.EX_OK)
+ def test_check_result_zero(self):
+ self.test.criteria = 0
+ self.test.result = 0
+ self.assertEqual(self.test.check_result(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
if __name__ == "__main__":
unittest.main(verbosity=2)
diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py
index 96706040..540cf610 100644
--- a/functest/tests/unit/core/test_vnf_base.py
+++ b/functest/tests/unit/core/test_vnf_base.py
@@ -23,7 +23,7 @@ class VnfBaseTesting(unittest.TestCase):
self.test.project = "functest"
self.test.start_time = "1"
self.test.stop_time = "5"
- self.test.criteria = ""
+ self.test.result = ""
self.test.details = {"orchestrator": {"status": "PASS",
"result": "",
"duration": 20},
diff --git a/functest/tests/unit/features/test_barometer.py b/functest/tests/unit/features/test_barometer.py
index 62f2e0d6..8ca463b2 100644
--- a/functest/tests/unit/features/test_barometer.py
+++ b/functest/tests/unit/features/test_barometer.py
@@ -19,36 +19,31 @@ from functest.core import testcase
sys.modules['baro_tests'] = mock.Mock() # noqa
# pylint: disable=wrong-import-position
from functest.opnfv_tests.features import barometer
-from functest.utils import constants
class BarometerTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "barometercollectd"
+ _project_name = "barometer"
+
def setUp(self):
self.barometer = barometer.BarometerCollectd(
- case_name="barometercollectd")
+ case_name=self._case_name, project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.barometer.project_name, "barometer")
- self.assertEqual(self.barometer.case_name, "barometercollectd")
- self.assertEqual(
- self.barometer.repo,
- constants.CONST.__getattribute__('dir_repo_barometer'))
-
- @unittest.skip("JIRA: FUNCTEST-777")
- def test_execute_ko(self):
- # It must be skipped to allow merging
+ self.assertEqual(self.barometer.project_name, self._project_name)
+ self.assertEqual(self.barometer.case_name, self._case_name)
+
+ def test_run_ko(self):
sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=1)
- self.assertEqual(self.barometer.execute(),
+ self.assertEqual(self.barometer.run(),
testcase.TestCase.EX_RUN_ERROR)
- @unittest.skip("JIRA: FUNCTEST-777")
- def test_execute(self):
- # It must be skipped to allow merging
+ def test_run(self):
sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=0)
- self.assertEqual(self.barometer.execute(), testcase.TestCase.EX_OK)
+ self.assertEqual(self.barometer.run(), testcase.TestCase.EX_OK)
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_copper.py b/functest/tests/unit/features/test_copper.py
deleted file mode 100644
index b6d187f7..00000000
--- a/functest/tests/unit/features/test_copper.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import copper
-from functest.utils import constants
-
-
-class CopperTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.copper = copper.Copper(case_name="copper-notification")
-
- def test_init(self):
- self.assertEqual(self.copper.project_name, "copper")
- self.assertEqual(self.copper.case_name, "copper-notification")
- self.assertEqual(
- self.copper.repo,
- constants.CONST.__getattribute__("dir_repo_copper"))
- self.assertEqual(
- self.copper.cmd,
- "cd {}/tests && bash run.sh && cd -".format(self.copper.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_doctor.py b/functest/tests/unit/features/test_doctor.py
deleted file mode 100644
index 36bac44f..00000000
--- a/functest/tests/unit/features/test_doctor.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import doctor
-from functest.utils import constants
-
-
-class DoctorTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.doctor = doctor.Doctor(case_name="doctor-notification")
-
- def test_init(self):
- self.assertEqual(self.doctor.project_name, "doctor")
- self.assertEqual(self.doctor.case_name, "doctor-notification")
- self.assertEqual(
- self.doctor.repo,
- constants.CONST.__getattribute__("dir_repo_doctor"))
- self.assertEqual(
- self.doctor.cmd,
- 'cd {}/tests && ./run.sh'.format(self.doctor.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_domino.py b/functest/tests/unit/features/test_domino.py
deleted file mode 100644
index c0bfd14b..00000000
--- a/functest/tests/unit/features/test_domino.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import domino
-from functest.utils import constants
-
-
-class DominoTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.domino = domino.Domino(case_name="domino-multinode")
-
- def test_init(self):
- self.assertEqual(self.domino.project_name, "domino")
- self.assertEqual(self.domino.case_name, "domino-multinode")
- self.assertEqual(
- self.domino.repo,
- constants.CONST.__getattribute__("dir_repo_domino"))
- self.assertEqual(
- self.domino.cmd,
- 'cd {} && ./tests/run_multinode.sh'.format(self.domino.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_netready.py b/functest/tests/unit/features/test_netready.py
deleted file mode 100644
index 47be4203..00000000
--- a/functest/tests/unit/features/test_netready.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import netready
-from functest.utils import constants
-
-
-class NetreadyTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.netready = netready.GluonVping(case_name="gluon_vping")
-
- def test_init(self):
- self.assertEqual(self.netready.project_name, "netready")
- self.assertEqual(self.netready.case_name, "gluon_vping")
- self.assertEqual(
- self.netready.repo,
- constants.CONST.__getattribute__("dir_repo_netready"))
- self.assertEqual(
- self.netready.cmd,
- 'cd {}/test/functest && python ./gluon-test-suite.py'.format(
- self.netready.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_odl_sfc.py b/functest/tests/unit/features/test_odl_sfc.py
deleted file mode 100644
index dcdcdff6..00000000
--- a/functest/tests/unit/features/test_odl_sfc.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import odl_sfc
-from functest.utils import constants
-
-
-class OpenDaylightSFCTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.odl_sfc = odl_sfc.OpenDaylightSFC(case_name="functest-odl-sfc")
-
- def test_init(self):
- self.assertEqual(self.odl_sfc.project_name, "sfc")
- self.assertEqual(self.odl_sfc.case_name, "functest-odl-sfc")
- self.assertEqual(
- self.odl_sfc.repo,
- constants.CONST.__getattribute__("dir_repo_sfc"))
- dir_sfc_functest = '{}/sfc/tests/functest'.format(self.odl_sfc.repo)
- self.assertEqual(
- self.odl_sfc.cmd,
- 'cd {} && python ./run_tests.py'.format(dir_sfc_functest))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_promise.py b/functest/tests/unit/features/test_promise.py
deleted file mode 100644
index 29b4d4ec..00000000
--- a/functest/tests/unit/features/test_promise.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import promise
-from functest.utils import constants
-
-
-class PromiseTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.promise = promise.Promise(case_name="promise")
-
- def test_init(self):
- self.assertEqual(self.promise.project_name, "promise")
- self.assertEqual(self.promise.case_name, "promise")
- self.assertEqual(
- self.promise.repo,
- constants.CONST.__getattribute__("dir_repo_promise"))
- self.assertEqual(
- self.promise.cmd,
- 'cd {}/promise/test/functest && python ./run_tests.py'.format(
- self.promise.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_sdnvpn.py b/functest/tests/unit/features/test_sdnvpn.py
deleted file mode 100644
index 8fa43fc4..00000000
--- a/functest/tests/unit/features/test_sdnvpn.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import sdnvpn
-from functest.utils import constants
-
-
-class SdnVpnTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.sdnvpn = sdnvpn.SdnVpnTests(case_name="bgpvpn")
-
- def test_init(self):
- self.assertEqual(self.sdnvpn.project_name, "sdnvpn")
- self.assertEqual(self.sdnvpn.case_name, "bgpvpn")
- self.assertEqual(
- self.sdnvpn.repo,
- constants.CONST.__getattribute__("dir_repo_sdnvpn"))
- self.assertEqual(
- self.sdnvpn.cmd,
- 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format(
- self.sdnvpn.repo))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/features/test_security_scan.py b/functest/tests/unit/features/test_security_scan.py
deleted file mode 100644
index f0e40159..00000000
--- a/functest/tests/unit/features/test_security_scan.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2017 Orange and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# pylint: disable=missing-docstring
-
-import logging
-import unittest
-
-from functest.opnfv_tests.features import security_scan
-from functest.utils import constants
-
-
-class SecurityScanTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.sscan = security_scan.SecurityScan(case_name="security_scan")
-
- def test_init(self):
- self.assertEqual(self.sscan.project_name, "securityscanning")
- self.assertEqual(self.sscan.case_name, "security_scan")
- self.assertEqual(
- self.sscan.repo,
- constants.CONST.__getattribute__("dir_repo_securityscan"))
- self.assertEqual(
- self.sscan.cmd, (
- '. {0}/stackrc && cd {1} && '
- 'python security_scan.py --config config.ini && '
- 'cd -'.format(
- constants.CONST.__getattribute__("dir_functest_conf"),
- self.sscan.repo)))
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index e08deb27..54d6da72 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -90,7 +90,7 @@ class ODLTesting(unittest.TestCase):
os.environ["OS_USERNAME"] = self._os_username
os.environ["OS_PASSWORD"] = self._os_password
os.environ["OS_TENANT_NAME"] = self._os_tenantname
- self.test = odl.ODLTests()
+ self.test = odl.ODLTests(case_name='odl', project_name='functest')
self.defaultargs = {'odlusername': self._odl_username,
'odlpassword': self._odl_password,
'neutronip': self._keystone_ip,
@@ -113,7 +113,8 @@ class ODLParseResultTesting(ODLTesting):
def test_raises_exc(self, mock_method):
with self.assertRaises(DataError):
self.test.parse_results()
- mock_method.assert_called_once_with()
+ mock_method.assert_called_once_with(
+ os.path.join(odl.ODLTests.res_dir, 'output.xml'))
def test_ok(self):
config = {'name': 'dummy', 'starttime': '20161216 16:00:00.000',
@@ -123,7 +124,7 @@ class ODLParseResultTesting(ODLTesting):
with mock.patch('robot.api.ExecutionResult',
return_value=mock.Mock(suite=suite)):
self.test.parse_results()
- self.assertEqual(self.test.criteria, config['status'])
+ self.assertEqual(self.test.result, config['status'])
self.assertEqual(self.test.start_time,
timestamp_to_secs(config['starttime']))
self.assertEqual(self.test.stop_time,
@@ -368,19 +369,10 @@ class ODLRunTesting(ODLTesting):
"""The class testing ODLTests.run()."""
# pylint: disable=missing-docstring
- @classmethod
- def _fake_url_for(cls, service_type='identity'):
- if service_type == 'identity':
- return "http://{}:5000/v2.0".format(
- ODLTesting._keystone_ip)
- elif service_type == 'network':
- return "http://{}:9696".format(ODLTesting._neutron_ip)
- else:
- return None
-
def _test_no_env_var(self, var):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
del os.environ[var]
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -393,7 +385,8 @@ class ODLRunTesting(ODLTesting):
if 'odlrestconfport' in kwargs else '8181')
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
if exception:
self.test.main = mock.Mock(side_effect=exception)
else:
@@ -410,18 +403,15 @@ class ODLRunTesting(ODLTesting):
osusername=self._os_username)
def _test_multiple_suites(self, suites,
- status=testcase.TestCase.EX_OK,
- exception=None, **kwargs):
+ status=testcase.TestCase.EX_OK, **kwargs):
odlip = kwargs['odlip'] if 'odlip' in kwargs else '127.0.0.3'
odlwebport = kwargs['odlwebport'] if 'odlwebport' in kwargs else '8080'
odlrestconfport = (kwargs['odlrestconfport']
if 'odlrestconfport' in kwargs else '8181')
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
- if exception:
- self.test.main = mock.Mock(side_effect=exception)
- else:
- self.test.main = mock.Mock(return_value=status)
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
+ self.test.main = mock.Mock(return_value=status)
self.assertEqual(self.test.run(suites=suites), status)
self.test.main.assert_called_once_with(
suites,
@@ -467,7 +457,8 @@ class ODLRunTesting(ODLTesting):
def test_no_sdn_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -492,7 +483,8 @@ class ODLRunTesting(ODLTesting):
def test_apex_no_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
os.environ["INSTALLER_TYPE"] = "apex"
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -506,7 +498,8 @@ class ODLRunTesting(ODLTesting):
def test_netvirt_no_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
os.environ["INSTALLER_TYPE"] = "netvirt"
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -520,7 +513,8 @@ class ODLRunTesting(ODLTesting):
def test_joid_no_controller_ip(self):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
- side_effect=self._fake_url_for):
+ return_value="http://{}:9696".format(
+ ODLTesting._neutron_ip)):
os.environ["INSTALLER_TYPE"] = "joid"
self.assertEqual(self.test.run(),
testcase.TestCase.EX_RUN_ERROR)
@@ -563,7 +557,7 @@ class ODLArgParserTesting(ODLTesting):
self.defaultargs['foo'] = 'bar'
with self.assertRaises(SystemExit):
self.parser.parse_args(["--foo=bar"])
- mock_method.assert_called_once_with()
+ self.assertTrue(mock_method.getvalue().startswith("usage:"))
def _test_arg(self, arg, value):
self.defaultargs[arg] = value
diff --git a/functest/tests/unit/opnfv_tests/__init__.py b/functest/tests/unit/openstack/__init__.py
index e69de29b..e69de29b 100644
--- a/functest/tests/unit/opnfv_tests/__init__.py
+++ b/functest/tests/unit/openstack/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/__init__.py b/functest/tests/unit/openstack/rally/__init__.py
index e69de29b..e69de29b 100644
--- a/functest/tests/unit/opnfv_tests/openstack/__init__.py
+++ b/functest/tests/unit/openstack/rally/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py
index fe25dfcf..fe25dfcf 100644
--- a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py
+++ b/functest/tests/unit/openstack/rally/test_rally.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/rally/__init__.py b/functest/tests/unit/openstack/refstack_client/__init__.py
index e69de29b..e69de29b 100644
--- a/functest/tests/unit/opnfv_tests/openstack/rally/__init__.py
+++ b/functest/tests/unit/openstack/refstack_client/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
index 60e180c9..60e180c9 100644
--- a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py
+++ b/functest/tests/unit/openstack/refstack_client/test_refstack_client.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/refstack_client/__init__.py b/functest/tests/unit/openstack/tempest/__init__.py
index e69de29b..e69de29b 100644
--- a/functest/tests/unit/opnfv_tests/openstack/refstack_client/__init__.py
+++ b/functest/tests/unit/openstack/tempest/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index 8ca5cc5b..8ca5cc5b 100644
--- a/functest/tests/unit/opnfv_tests/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index 34031b40..e05e5dfa 100644
--- a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -105,7 +105,7 @@ class OSTempestTesting(unittest.TestCase):
self._test_generate_test_list_mode_default('full')
def test_parse_verifier_result_missing_verification_uuid(self):
- self.tempestcommon.VERIFICATION_ID = ''
+ self.tempestcommon.VERIFICATION_ID = None
with self.assertRaises(Exception):
self.tempestcommon.parse_verifier_result()
@@ -169,100 +169,82 @@ class OSTempestTesting(unittest.TestCase):
self.tempestcommon.parse_verifier_result()
mock_method.assert_any_call('test_case_name', 100)
- def test_run_missing_create_tempest_dir(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value="image_and_flavor"):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
-
- def test_run_missing_configure_tempest(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs',
+ side_effect=Exception)
+ def test_run_makedirs_ko(self, *args):
+ self.assertEqual(self.tempestcommon.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.create_tempest_resources', side_effect=Exception)
+ def test_run_create_tempest_resources_ko(self, *args):
+ self.assertEqual(self.tempestcommon.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.create_tempest_resources', return_value={})
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest', side_effect=Exception)
+ def test_run_configure_tempest_ko(self, *args):
+ self.assertEqual(self.tempestcommon.run(),
+ testcase.TestCase.EX_RUN_ERROR)
+
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'os.path.exists', return_value=False)
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.os.makedirs')
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.create_tempest_resources', return_value={})
+ @mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
+ 'conf_utils.configure_tempest')
+ def _test_run(self, status, *args):
+ self.assertEqual(self.tempestcommon.run(), status)
def test_run_missing_generate_test_list(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'generate_test_list',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
-
- def test_run_missing_apply_tempest_blacklist(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'generate_test_list',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'apply_tempest_blacklist',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
-
- def test_run_missing_parse_verifier_result(self):
- ret = testcase.TestCase.EX_RUN_ERROR
- ret_ok = testcase.TestCase.EX_OK
- with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.path.exists', return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'os.makedirs') as mock_os_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.create_tempest_resources',
- return_value=ret_ok), \
- mock.patch('functest.opnfv_tests.openstack.tempest.tempest.'
- 'conf_utils.configure_tempest',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'generate_test_list',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'apply_tempest_blacklist',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'run_verifier_tests',
- return_value=ret_ok), \
- mock.patch.object(self.tempestcommon, 'parse_verifier_result',
- return_value=ret):
- self.assertEqual(self.tempestcommon.run(),
- ret)
- self.assertTrue(mock_os_makedirs.called)
+ with mock.patch.object(self.tempestcommon, 'generate_test_list',
+ side_effect=Exception):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run_apply_tempest_blacklist_ko(self):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist',
+ side_effect=Exception()):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run_verifier_tests_ko(self, *args):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist'), \
+ mock.patch.object(self.tempestcommon, 'run_verifier_tests',
+ side_effect=Exception()), \
+ mock.patch.object(self.tempestcommon, 'parse_verifier_result',
+ side_effect=Exception):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run_parse_verifier_result_ko(self, *args):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist'), \
+ mock.patch.object(self.tempestcommon, 'run_verifier_tests'), \
+ mock.patch.object(self.tempestcommon, 'parse_verifier_result',
+ side_effect=Exception):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+ def test_run(self, *args):
+ with mock.patch.object(self.tempestcommon, 'generate_test_list'), \
+ mock.patch.object(self.tempestcommon,
+ 'apply_tempest_blacklist'), \
+ mock.patch.object(self.tempestcommon, 'run_verifier_tests'), \
+ mock.patch.object(self.tempestcommon, 'parse_verifier_result'):
+ self._test_run(testcase.TestCase.EX_OK)
if __name__ == "__main__":
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index eb241e5d..573fcb70 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -41,8 +41,8 @@ class FunctestUtilsTesting(unittest.TestCase):
self.status = 'test_status'
self.details = 'test_details'
self.db_url = 'test_db_url'
- self.success_rate = 2.0
- self.criteria = 'test_criteria==2.0'
+ self.criteria = 50
+ self.result = 75
self.start_date = 1482624000
self.stop_date = 1482624000
self.start_time = time.time()
@@ -54,7 +54,8 @@ class FunctestUtilsTesting(unittest.TestCase):
self.cmd = 'test_cmd'
self.output_file = 'test_output_file'
self.testname = 'testname'
- self.testcase_dict = {'name': 'testname', 'criteria': self.criteria}
+ self.testcase_dict = {'case_name': 'testname',
+ 'criteria': self.criteria}
self.parameter = 'general.openstack.image_name'
self.config_yaml = 'test_config_yaml-'
self.db_url_env = 'http://foo/testdb'
@@ -278,7 +279,7 @@ class FunctestUtilsTesting(unittest.TestCase):
as mock_logger_error:
functest_utils.push_results_to_db(self.project, self.case_name,
self.start_date, self.stop_date,
- self.criteria, self.details)
+ self.result, self.details)
mock_logger_error.assert_called_once_with("Please set env var: " +
str("\'" + env_var +
"\'"))
@@ -310,7 +311,7 @@ class FunctestUtilsTesting(unittest.TestCase):
push_results_to_db(self.project, self.case_name,
self.start_date,
self.stop_date,
- self.criteria, self.details))
+ self.result, self.details))
mock_logger_error.assert_called_once_with(test_utils.
RegexMatch("Pushing "
"Result to"
@@ -333,7 +334,7 @@ class FunctestUtilsTesting(unittest.TestCase):
push_results_to_db(self.project, self.case_name,
self.start_date,
self.stop_date,
- self.criteria, self.details))
+ self.result, self.details))
self.assertTrue(mock_logger_error.called)
def test_push_results_to_db_default(self):
@@ -348,7 +349,7 @@ class FunctestUtilsTesting(unittest.TestCase):
push_results_to_db(self.project, self.case_name,
self.start_date,
self.stop_date,
- self.criteria, self.details))
+ self.result, self.details))
readline = 0
test_ip = ['10.1.23.4', '10.1.14.15', '10.1.16.15']
@@ -565,7 +566,7 @@ class FunctestUtilsTesting(unittest.TestCase):
as mock_criteria:
mock_criteria.return_value = self.criteria
resp = functest_utils.check_success_rate(self.case_name,
- self.success_rate)
+ self.result)
self.assertEqual(resp, 'PASS')
def test_check_success_rate_failed(self):
@@ -573,7 +574,7 @@ class FunctestUtilsTesting(unittest.TestCase):
as mock_criteria:
mock_criteria.return_value = self.criteria
resp = functest_utils.check_success_rate(self.case_name,
- 3.0)
+ 0)
self.assertEqual(resp, 'FAIL')
# TODO: merge_dicts
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py b/functest/tests/unit/vnf/__init__.py
index e69de29b..e69de29b 100644
--- a/functest/tests/unit/opnfv_tests/openstack/tempest/__init__.py
+++ b/functest/tests/unit/vnf/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/__init__.py b/functest/tests/unit/vnf/ims/__init__.py
index e69de29b..e69de29b 100644
--- a/functest/tests/unit/opnfv_tests/vnf/__init__.py
+++ b/functest/tests/unit/vnf/ims/__init__.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_clearwater.py b/functest/tests/unit/vnf/ims/test_clearwater.py
index 18bebfdf..18bebfdf 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_clearwater.py
+++ b/functest/tests/unit/vnf/ims/test_clearwater.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_cloudify_ims.py b/functest/tests/unit/vnf/ims/test_cloudify_ims.py
index f47ea865..f47ea865 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_cloudify_ims.py
+++ b/functest/tests/unit/vnf/ims/test_cloudify_ims.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by b/functest/tests/unit/vnf/ims/test_ims_base.py
index 9440bcdf..e283199c 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by
+++ b/functest/tests/unit/vnf/ims/test_ims_base.py
@@ -10,7 +10,7 @@ import unittest
import mock
-from functest.opnfv_tests.vnf.ims import ims_base
+from functest.opnfv_tests.vnf.ims import clearwater_ims_base as ims_base
class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
@@ -38,8 +38,8 @@ class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
self.mock_post_200.configure_mock(**attrs)
def test_create_ellis_number_failure(self):
- with mock.patch('functest.opnfv_tests.vnf.ims.ims_base.'
- 'requests.post',
+ with mock.patch('functest.opnfv_tests.vnf.ims.'
+ 'clearwater_ims_base.requests.post',
return_value=self.mock_post_500), \
self.assertRaises(Exception) as context:
self.ims_vnf.create_ellis_number()
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_orchestrator_cloudify.py b/functest/tests/unit/vnf/ims/test_orchestrator_cloudify.py
index bf6d483f..bf6d483f 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_orchestrator_cloudify.py
+++ b/functest/tests/unit/vnf/ims/test_orchestrator_cloudify.py
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/__init__.py b/functest/tests/unit/vnf/rnc/__init__.py
index e69de29b..e69de29b 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/__init__.py
+++ b/functest/tests/unit/vnf/rnc/__init__.py