aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorvalentin boucher <valentin.boucher@orange.com>2017-04-04 13:12:56 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-04-04 13:12:56 +0000
commitd06d840c00d4e3b58b826447e17035469e967357 (patch)
treed7941107f940203352422808e1777c5dce5de32b /functest/tests/unit
parent7af7f85cc1d8cc0ef05ec839a70504f89d38f806 (diff)
parent457321c2c8ed7e8dcb1daccb6d2fd9814e6a98ca (diff)
Merge "Add case_name as constructor arg"
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/core/test_testcase.py15
-rw-r--r--functest/tests/unit/core/test_vnf_base.py3
2 files changed, 11 insertions, 7 deletions
diff --git a/functest/tests/unit/core/test_testcase.py b/functest/tests/unit/core/test_testcase.py
index 32104194..5ff41cd6 100644
--- a/functest/tests/unit/core/test_testcase.py
+++ b/functest/tests/unit/core/test_testcase.py
@@ -26,10 +26,11 @@ class TestCaseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "base"
+
def setUp(self):
- self.test = testcase.TestCase()
+ self.test = testcase.TestCase(case_name=self._case_name)
self.test.project = "functest"
- self.test.case_name = "base"
self.test.start_time = "1"
self.test.stop_time = "2"
self.test.criteria = "PASS"
@@ -46,6 +47,10 @@ class TestCaseTesting(unittest.TestCase):
testcase.TestCase.EX_PUSH_TO_DB_ERROR)
mock_function.assert_not_called()
+ def test_missing_project_name(self):
+ self.test.project_name = None
+ self._test_missing_attribute()
+
def test_missing_case_name(self):
self.test.case_name = None
self._test_missing_attribute()
@@ -69,7 +74,7 @@ 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.test.case_name, self.test.start_time,
+ self.test.project, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
@@ -78,7 +83,7 @@ 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.test.case_name, self.test.start_time,
+ self.test.project, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
@@ -87,7 +92,7 @@ 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.test.case_name, self.test.start_time,
+ self.test.project, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
def test_check_criteria_missing(self):
diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py
index 1680f03f..96706040 100644
--- a/functest/tests/unit/core/test_vnf_base.py
+++ b/functest/tests/unit/core/test_vnf_base.py
@@ -19,9 +19,8 @@ class VnfBaseTesting(unittest.TestCase):
def setUp(self):
self.test = vnf_base.VnfOnBoardingBase(project='functest',
- case='aaa')
+ case_name='aaa')
self.test.project = "functest"
- self.test.case_name = "aaa"
self.test.start_time = "1"
self.test.stop_time = "5"
self.test.criteria = ""