diff options
Diffstat (limited to 'functest/tests/unit/features')
-rw-r--r-- | functest/tests/unit/features/test_barometer.py | 27 | ||||
-rw-r--r-- | functest/tests/unit/features/test_copper.py | 17 | ||||
-rw-r--r-- | functest/tests/unit/features/test_doctor.py | 18 | ||||
-rw-r--r-- | functest/tests/unit/features/test_domino.py | 18 | ||||
-rw-r--r-- | functest/tests/unit/features/test_netready.py | 19 | ||||
-rw-r--r-- | functest/tests/unit/features/test_odl_sfc.py | 15 | ||||
-rw-r--r-- | functest/tests/unit/features/test_promise.py | 18 | ||||
-rw-r--r-- | functest/tests/unit/features/test_sdnvpn.py | 19 | ||||
-rw-r--r-- | functest/tests/unit/features/test_security_scan.py | 20 |
9 files changed, 90 insertions, 81 deletions
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 index b6d187f7..56bf4137 100644 --- a/functest/tests/unit/features/test_copper.py +++ b/functest/tests/unit/features/test_copper.py @@ -13,25 +13,26 @@ import logging import unittest from functest.opnfv_tests.features import copper -from functest.utils import constants +from functest.utils.constants import CONST 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.repo, - constants.CONST.__getattribute__("dir_repo_copper")) + self.assertEqual(self.copper.project_name, self._project_name) + repo = CONST.__getattribute__('dir_repo_copper') self.assertEqual( self.copper.cmd, - "cd {}/tests && bash run.sh && cd -".format(self.copper.repo)) + "cd {}/tests && bash run.sh && cd -".format(repo)) if __name__ == "__main__": diff --git a/functest/tests/unit/features/test_doctor.py b/functest/tests/unit/features/test_doctor.py index 36bac44f..650d1509 100644 --- a/functest/tests/unit/features/test_doctor.py +++ b/functest/tests/unit/features/test_doctor.py @@ -13,25 +13,27 @@ import logging import unittest from functest.opnfv_tests.features import doctor -from functest.utils import constants +from functest.utils.constants import CONST 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.repo, - constants.CONST.__getattribute__("dir_repo_doctor")) + self.assertEqual(self.doctor.project_name, self._project_name) + self.assertEqual(self.doctor.case_name, self._case_name) + repo = CONST.__getattribute__('dir_repo_doctor') self.assertEqual( self.doctor.cmd, - 'cd {}/tests && ./run.sh'.format(self.doctor.repo)) + 'cd {}/tests && ./run.sh'.format(repo)) if __name__ == "__main__": diff --git a/functest/tests/unit/features/test_domino.py b/functest/tests/unit/features/test_domino.py index c0bfd14b..f311af33 100644 --- a/functest/tests/unit/features/test_domino.py +++ b/functest/tests/unit/features/test_domino.py @@ -13,25 +13,27 @@ import logging import unittest from functest.opnfv_tests.features import domino -from functest.utils import constants +from functest.utils.constants import CONST 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.repo, - constants.CONST.__getattribute__("dir_repo_domino")) + self.assertEqual(self.domino.project_name, self._project_name) + self.assertEqual(self.domino.case_name, self._case_name) + repo = CONST.__getattribute__('dir_repo_domino') self.assertEqual( self.domino.cmd, - 'cd {} && ./tests/run_multinode.sh'.format(self.domino.repo)) + 'cd {} && ./tests/run_multinode.sh'.format(repo)) if __name__ == "__main__": diff --git a/functest/tests/unit/features/test_netready.py b/functest/tests/unit/features/test_netready.py index 47be4203..96840195 100644 --- a/functest/tests/unit/features/test_netready.py +++ b/functest/tests/unit/features/test_netready.py @@ -13,26 +13,27 @@ import logging import unittest from functest.opnfv_tests.features import netready -from functest.utils import constants +from functest.utils.constants import CONST 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.repo, - constants.CONST.__getattribute__("dir_repo_netready")) + self.assertEqual(self.netready.project_name, self._project_name) + self.assertEqual(self.netready.case_name, self._case_name) + repo = CONST.__getattribute__('dir_repo_netready') self.assertEqual( self.netready.cmd, - 'cd {}/test/functest && python ./gluon-test-suite.py'.format( - self.netready.repo)) + 'cd {}/test/functest && python ./gluon-test-suite.py'.format(repo)) if __name__ == "__main__": diff --git a/functest/tests/unit/features/test_odl_sfc.py b/functest/tests/unit/features/test_odl_sfc.py index dcdcdff6..5673e2b1 100644 --- a/functest/tests/unit/features/test_odl_sfc.py +++ b/functest/tests/unit/features/test_odl_sfc.py @@ -13,23 +13,26 @@ import logging import unittest from functest.opnfv_tests.features import odl_sfc -from functest.utils import constants +from functest.utils.constants import CONST 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") 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) + repo = CONST.__getattribute__('dir_repo_sfc') + dir_sfc_functest = '{}/sfc/tests/functest'.format(repo) self.assertEqual( self.odl_sfc.cmd, 'cd {} && python ./run_tests.py'.format(dir_sfc_functest)) diff --git a/functest/tests/unit/features/test_promise.py b/functest/tests/unit/features/test_promise.py index 29b4d4ec..8fa1fba0 100644 --- a/functest/tests/unit/features/test_promise.py +++ b/functest/tests/unit/features/test_promise.py @@ -13,26 +13,28 @@ import logging import unittest from functest.opnfv_tests.features import promise -from functest.utils import constants +from functest.utils.constants import CONST 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.repo, - constants.CONST.__getattribute__("dir_repo_promise")) + self.assertEqual(self.promise.project_name, self._project_name) + self.assertEqual(self.promise.case_name, self._case_name) + repo = CONST.__getattribute__('dir_repo_promise') self.assertEqual( self.promise.cmd, 'cd {}/promise/test/functest && python ./run_tests.py'.format( - self.promise.repo)) + repo)) if __name__ == "__main__": diff --git a/functest/tests/unit/features/test_sdnvpn.py b/functest/tests/unit/features/test_sdnvpn.py index 8fa43fc4..75657fc4 100644 --- a/functest/tests/unit/features/test_sdnvpn.py +++ b/functest/tests/unit/features/test_sdnvpn.py @@ -13,26 +13,27 @@ import logging import unittest from functest.opnfv_tests.features import sdnvpn -from functest.utils import constants +from functest.utils.constants import CONST 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.repo, - constants.CONST.__getattribute__("dir_repo_sdnvpn")) + self.assertEqual(self.sdnvpn.project_name, self._project_name) + self.assertEqual(self.sdnvpn.case_name, self._case_name) + repo = CONST.__getattribute__('dir_repo_sdnvpn') self.assertEqual( self.sdnvpn.cmd, - 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format( - self.sdnvpn.repo)) + 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format(repo)) if __name__ == "__main__": diff --git a/functest/tests/unit/features/test_security_scan.py b/functest/tests/unit/features/test_security_scan.py index f0e40159..61ae9dc1 100644 --- a/functest/tests/unit/features/test_security_scan.py +++ b/functest/tests/unit/features/test_security_scan.py @@ -13,29 +13,31 @@ import logging import unittest from functest.opnfv_tests.features import security_scan -from functest.utils import constants +from functest.utils.constants import CONST 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.repo, - constants.CONST.__getattribute__("dir_repo_securityscan")) + self.assertEqual(self.sscan.project_name, self._project_name) + self.assertEqual(self.sscan.case_name, self._case_name) + repo = 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))) + CONST.__getattribute__("dir_functest_conf"), + repo))) if __name__ == "__main__": |