diff options
Diffstat (limited to 'functest/tests/unit')
18 files changed, 194 insertions, 167 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..ac4b04c4 100644 --- a/functest/tests/unit/core/test_feature.py +++ b/functest/tests/unit/core/test_feature.py @@ -16,92 +16,68 @@ import mock from functest.core import feature from functest.core import testcase -from functest.utils import constants +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' - 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(), status) + if status == testcase.TestCase.EX_OK: + self.assertEqual(self.feature.criteria, 'PASS') + else: + self.assertEqual(self.feature.criteria, 'FAIL') + 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') - - @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): - # 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 = feature.Feature( + project_name=self._project_name, case_name=self._case_name, + 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, + cmd=self._cmd) + + @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..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..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__": 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/opnfv_tests/vnf/ims/test_ims_base.by b/functest/tests/unit/opnfv_tests/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/opnfv_tests/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/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/__init__.py b/functest/tests/unit/vnf/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/functest/tests/unit/vnf/__init__.py diff --git a/functest/tests/unit/vnf/rnc/__init__.py b/functest/tests/unit/vnf/rnc/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/functest/tests/unit/vnf/rnc/__init__.py diff --git a/functest/tests/unit/vnf/rnc/test_parser.py b/functest/tests/unit/vnf/rnc/test_parser.py new file mode 100644 index 00000000..9e310cce --- /dev/null +++ b/functest/tests/unit/vnf/rnc/test_parser.py @@ -0,0 +1,40 @@ +#!/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.vnf.rnc import parser +from functest.utils.constants import CONST + + +class ParserTesting(unittest.TestCase): + + logging.disable(logging.CRITICAL) + + _case_name = "parser-basics" + _project_name = "parser" + + def setUp(self): + self.parser = parser.Parser( + case_name=self._case_name, project_name=self._project_name) + + def test_init(self): + self.assertEqual(self.parser.project_name, self._project_name) + self.assertEqual(self.parser.case_name, self._case_name) + repo = CONST.__getattribute__('dir_repo_parser') + self.assertEqual( + self.parser.cmd, + 'cd {}/tests && ./functest_run.sh'.format(repo)) + + +if __name__ == "__main__": + unittest.main(verbosity=2) |