aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-04-08 13:38:45 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-04-11 14:23:21 +0200
commit96bacd7d8ffb9c05672c0a1fc6e68d19e4a6793a (patch)
tree7e0fa1d220628aa0ea3f6b0d36702224e2891628 /functest/tests/unit
parentccc675b3095271d59dba3a49c0b116d0ff6c6bfb (diff)
Modify TestCase constructor attributes
Every feature/testcase now allows receiving the data defined in testcases.yaml as args (name is renamed to case_name). From the time being, only project and case names are handled. Next pending patches will add criteria, cmd and repo to this list. It keeps the default values for case names except for features which will be aggregated into Feature. Change-Id: Id742d100b8183d7f10894c24ae6879d1b2b60ac9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/ci/test_tier_builder.py2
-rw-r--r--functest/tests/unit/core/test_testcase.py11
-rw-r--r--functest/tests/unit/features/test_barometer.py9
-rw-r--r--functest/tests/unit/features/test_copper.py10
-rw-r--r--functest/tests/unit/features/test_doctor.py10
-rw-r--r--functest/tests/unit/features/test_domino.py10
-rw-r--r--functest/tests/unit/features/test_netready.py10
-rw-r--r--functest/tests/unit/features/test_odl_sfc.py7
-rw-r--r--functest/tests/unit/features/test_promise.py10
-rw-r--r--functest/tests/unit/features/test_sdnvpn.py10
-rw-r--r--functest/tests/unit/features/test_security_scan.py10
-rw-r--r--functest/tests/unit/odl/test_odl.py2
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py3
-rw-r--r--functest/tests/unit/vnf/rnc/test_parser.py10
14 files changed, 78 insertions, 36 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_testcase.py b/functest/tests/unit/core/test_testcase.py
index 5ff41cd6..4f3b25cc 100644
--- a/functest/tests/unit/core/test_testcase.py
+++ b/functest/tests/unit/core/test_testcase.py
@@ -27,10 +27,11 @@ class TestCaseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
_case_name = "base"
+ _project_name = "functest"
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"
@@ -74,7 +75,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._case_name, self.test.start_time,
+ self._project_name, 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',
@@ -83,7 +84,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._case_name, self.test.start_time,
+ self._project_name, 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',
@@ -92,7 +93,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._case_name, self.test.start_time,
+ self._project_name, 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/features/test_barometer.py b/functest/tests/unit/features/test_barometer.py
index 62f2e0d6..8afb56df 100644
--- a/functest/tests/unit/features/test_barometer.py
+++ b/functest/tests/unit/features/test_barometer.py
@@ -26,13 +26,16 @@ 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.project_name, self._project_name)
+ self.assertEqual(self.barometer.case_name, self._case_name)
self.assertEqual(
self.barometer.repo,
constants.CONST.__getattribute__('dir_repo_barometer'))
diff --git a/functest/tests/unit/features/test_copper.py b/functest/tests/unit/features/test_copper.py
index b6d187f7..e4ddc149 100644
--- a/functest/tests/unit/features/test_copper.py
+++ b/functest/tests/unit/features/test_copper.py
@@ -20,12 +20,16 @@ class CopperTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "copper-notification"
+ _project_name = "copper"
+
def setUp(self):
- self.copper = copper.Copper(case_name="copper-notification")
+ self.copper = copper.Copper(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.copper.project_name, "copper")
- self.assertEqual(self.copper.case_name, "copper-notification")
+ self.assertEqual(self.copper.project_name, self._project_name)
+ self.assertEqual(self.copper.case_name, self._case_name)
self.assertEqual(
self.copper.repo,
constants.CONST.__getattribute__("dir_repo_copper"))
diff --git a/functest/tests/unit/features/test_doctor.py b/functest/tests/unit/features/test_doctor.py
index 36bac44f..a8512883 100644
--- a/functest/tests/unit/features/test_doctor.py
+++ b/functest/tests/unit/features/test_doctor.py
@@ -20,12 +20,16 @@ class DoctorTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "doctor-notification"
+ _project_name = "doctor"
+
def setUp(self):
- self.doctor = doctor.Doctor(case_name="doctor-notification")
+ self.doctor = doctor.Doctor(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.doctor.project_name, "doctor")
- self.assertEqual(self.doctor.case_name, "doctor-notification")
+ self.assertEqual(self.doctor.project_name, self._project_name)
+ self.assertEqual(self.doctor.case_name, self._case_name)
self.assertEqual(
self.doctor.repo,
constants.CONST.__getattribute__("dir_repo_doctor"))
diff --git a/functest/tests/unit/features/test_domino.py b/functest/tests/unit/features/test_domino.py
index c0bfd14b..27353a4d 100644
--- a/functest/tests/unit/features/test_domino.py
+++ b/functest/tests/unit/features/test_domino.py
@@ -20,12 +20,16 @@ class DominoTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "domino-multinode"
+ _project_name = "domino"
+
def setUp(self):
- self.domino = domino.Domino(case_name="domino-multinode")
+ self.domino = domino.Domino(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.domino.project_name, "domino")
- self.assertEqual(self.domino.case_name, "domino-multinode")
+ self.assertEqual(self.domino.project_name, self._project_name)
+ self.assertEqual(self.domino.case_name, self._case_name)
self.assertEqual(
self.domino.repo,
constants.CONST.__getattribute__("dir_repo_domino"))
diff --git a/functest/tests/unit/features/test_netready.py b/functest/tests/unit/features/test_netready.py
index 47be4203..1a88e78a 100644
--- a/functest/tests/unit/features/test_netready.py
+++ b/functest/tests/unit/features/test_netready.py
@@ -20,12 +20,16 @@ class NetreadyTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "gluon_vping"
+ _project_name = "netready"
+
def setUp(self):
- self.netready = netready.GluonVping(case_name="gluon_vping")
+ self.netready = netready.GluonVping(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.netready.project_name, "netready")
- self.assertEqual(self.netready.case_name, "gluon_vping")
+ self.assertEqual(self.netready.project_name, self._project_name)
+ self.assertEqual(self.netready.case_name, self._case_name)
self.assertEqual(
self.netready.repo,
constants.CONST.__getattribute__("dir_repo_netready"))
diff --git a/functest/tests/unit/features/test_odl_sfc.py b/functest/tests/unit/features/test_odl_sfc.py
index dcdcdff6..439d5965 100644
--- a/functest/tests/unit/features/test_odl_sfc.py
+++ b/functest/tests/unit/features/test_odl_sfc.py
@@ -20,8 +20,13 @@ class OpenDaylightSFCTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "functest-odl-sfc"
+ _project_name = "sfc"
+
def setUp(self):
- self.odl_sfc = odl_sfc.OpenDaylightSFC(case_name="functest-odl-sfc")
+ self.odl_sfc = odl_sfc.OpenDaylightSFC(
+ case_name="functest-odl-sfc",
+ project_name=self._project_name)
def test_init(self):
self.assertEqual(self.odl_sfc.project_name, "sfc")
diff --git a/functest/tests/unit/features/test_promise.py b/functest/tests/unit/features/test_promise.py
index 29b4d4ec..2af9c670 100644
--- a/functest/tests/unit/features/test_promise.py
+++ b/functest/tests/unit/features/test_promise.py
@@ -20,12 +20,16 @@ class PromiseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "promise"
+ _project_name = "promise"
+
def setUp(self):
- self.promise = promise.Promise(case_name="promise")
+ self.promise = promise.Promise(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.promise.project_name, "promise")
- self.assertEqual(self.promise.case_name, "promise")
+ self.assertEqual(self.promise.project_name, self._project_name)
+ self.assertEqual(self.promise.case_name, self._case_name)
self.assertEqual(
self.promise.repo,
constants.CONST.__getattribute__("dir_repo_promise"))
diff --git a/functest/tests/unit/features/test_sdnvpn.py b/functest/tests/unit/features/test_sdnvpn.py
index 8fa43fc4..dd67d8b4 100644
--- a/functest/tests/unit/features/test_sdnvpn.py
+++ b/functest/tests/unit/features/test_sdnvpn.py
@@ -20,12 +20,16 @@ class SdnVpnTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "bgpvpn"
+ _project_name = "sdnvpn"
+
def setUp(self):
- self.sdnvpn = sdnvpn.SdnVpnTests(case_name="bgpvpn")
+ self.sdnvpn = sdnvpn.SdnVpnTests(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.sdnvpn.project_name, "sdnvpn")
- self.assertEqual(self.sdnvpn.case_name, "bgpvpn")
+ self.assertEqual(self.sdnvpn.project_name, self._project_name)
+ self.assertEqual(self.sdnvpn.case_name, self._case_name)
self.assertEqual(
self.sdnvpn.repo,
constants.CONST.__getattribute__("dir_repo_sdnvpn"))
diff --git a/functest/tests/unit/features/test_security_scan.py b/functest/tests/unit/features/test_security_scan.py
index f0e40159..081bf1f6 100644
--- a/functest/tests/unit/features/test_security_scan.py
+++ b/functest/tests/unit/features/test_security_scan.py
@@ -20,12 +20,16 @@ class SecurityScanTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "security_scan"
+ _project_name = "security_scan"
+
def setUp(self):
- self.sscan = security_scan.SecurityScan(case_name="security_scan")
+ self.sscan = security_scan.SecurityScan(
+ case_name=self._case_name, project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.sscan.project_name, "securityscanning")
- self.assertEqual(self.sscan.case_name, "security_scan")
+ self.assertEqual(self.sscan.project_name, self._project_name)
+ self.assertEqual(self.sscan.case_name, self._case_name)
self.assertEqual(
self.sscan.repo,
constants.CONST.__getattribute__("dir_repo_securityscan"))
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index e08deb27..55e100dd 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,
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index eb241e5d..22cadf0f 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -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'
diff --git a/functest/tests/unit/vnf/rnc/test_parser.py b/functest/tests/unit/vnf/rnc/test_parser.py
index 59f618ae..3a181fe8 100644
--- a/functest/tests/unit/vnf/rnc/test_parser.py
+++ b/functest/tests/unit/vnf/rnc/test_parser.py
@@ -20,12 +20,16 @@ class ParserTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "parser-basics"
+ _project_name = "parser"
+
def setUp(self):
- self.parser = parser.Parser(case_name="parser-basics")
+ self.parser = parser.Parser(
+ case_name=self._case_name, project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.parser.project_name, "parser")
- self.assertEqual(self.parser.case_name, "parser-basics")
+ self.assertEqual(self.parser.project_name, self._project_name)
+ self.assertEqual(self.parser.case_name, self._case_name)
self.assertEqual(
self.parser.repo,
constants.CONST.__getattribute__("dir_repo_parser"))