aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
authorCedric Ollivier <ollivier.cedric@gmail.com>2017-03-28 08:12:15 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-03-28 08:12:15 +0000
commit514c97b036cf968e03e600a4761757448bef0a0a (patch)
tree1c26ce72ed668b8e183da925d7b5bced89445e22 /functest/tests
parent5af67bcca589c275b73fe5e4bca9bea5871948aa (diff)
parent407d27585f109e3381bb49041abc49a14b7b5bfe (diff)
Merge "Switch TestcaseBase to TestCase"
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/core/test_testcase_base.py20
-rw-r--r--functest/tests/unit/odl/test_odl.py56
-rw-r--r--functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py4
-rw-r--r--functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py2
-rw-r--r--functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py18
5 files changed, 50 insertions, 50 deletions
diff --git a/functest/tests/unit/core/test_testcase_base.py b/functest/tests/unit/core/test_testcase_base.py
index 182da6ea..a98caead 100644
--- a/functest/tests/unit/core/test_testcase_base.py
+++ b/functest/tests/unit/core/test_testcase_base.py
@@ -15,12 +15,12 @@ import mock
from functest.core import testcase_base
-class TestcaseBaseTesting(unittest.TestCase):
+class TestCaseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
def setUp(self):
- self.test = testcase_base.TestcaseBase()
+ self.test = testcase_base.TestCase()
self.test.project = "functest"
self.test.case_name = "base"
self.test.start_time = "1"
@@ -30,13 +30,13 @@ class TestcaseBaseTesting(unittest.TestCase):
def test_run_unimplemented(self):
self.assertEqual(self.test.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
return_value=False)
def _test_missing_attribute(self, mock_function=None):
self.assertEqual(self.test.push_to_db(),
- testcase_base.TestcaseBase.EX_PUSH_TO_DB_ERROR)
+ testcase_base.TestCase.EX_PUSH_TO_DB_ERROR)
mock_function.assert_not_called()
def test_missing_case_name(self):
@@ -60,7 +60,7 @@ class TestcaseBaseTesting(unittest.TestCase):
def test_missing_details(self, mock_function=None):
self.test.details = None
self.assertEqual(self.test.push_to_db(),
- testcase_base.TestcaseBase.EX_OK)
+ testcase_base.TestCase.EX_OK)
mock_function.assert_called_once_with(
self.test.project, self.test.case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@@ -69,7 +69,7 @@ class TestcaseBaseTesting(unittest.TestCase):
return_value=False)
def test_push_to_db_failed(self, mock_function=None):
self.assertEqual(self.test.push_to_db(),
- testcase_base.TestcaseBase.EX_PUSH_TO_DB_ERROR)
+ testcase_base.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.stop_time, self.test.criteria, self.test.details)
@@ -78,7 +78,7 @@ class TestcaseBaseTesting(unittest.TestCase):
return_value=True)
def test_push_to_db(self, mock_function=None):
self.assertEqual(self.test.push_to_db(),
- testcase_base.TestcaseBase.EX_OK)
+ testcase_base.TestCase.EX_OK)
mock_function.assert_called_once_with(
self.test.project, self.test.case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@@ -86,17 +86,17 @@ class TestcaseBaseTesting(unittest.TestCase):
def test_check_criteria_missing(self):
self.test.criteria = None
self.assertEqual(self.test.check_criteria(),
- testcase_base.TestcaseBase.EX_TESTCASE_FAILED)
+ testcase_base.TestCase.EX_TESTCASE_FAILED)
def test_check_criteria_failed(self):
self.test.criteria = 'FAILED'
self.assertEqual(self.test.check_criteria(),
- testcase_base.TestcaseBase.EX_TESTCASE_FAILED)
+ testcase_base.TestCase.EX_TESTCASE_FAILED)
def test_check_criteria_pass(self):
self.test.criteria = 'PASS'
self.assertEqual(self.test.check_criteria(),
- testcase_base.TestcaseBase.EX_OK)
+ testcase_base.TestCase.EX_OK)
if __name__ == "__main__":
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index 5961940f..fc5c8b68 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -202,7 +202,7 @@ class ODLTesting(unittest.TestCase):
def _test_main_missing_keyword(self, key):
kwargs = self._get_main_kwargs(key)
self.assertEqual(self.test.main(**kwargs),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
def test_main_missing_odlusername(self):
self._test_main_missing_keyword('odlusername')
@@ -237,7 +237,7 @@ class ODLTesting(unittest.TestCase):
def test_main_set_robotframework_vars_failed(self):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=False):
- self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR)
+ self._test_main(testcase_base.TestCase.EX_RUN_ERROR)
self.test.set_robotframework_vars.assert_called_once_with(
self._odl_username, self._odl_password)
@@ -246,14 +246,14 @@ class ODLTesting(unittest.TestCase):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
self.assertRaises(Exception):
- self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR,
+ self._test_main(testcase_base.TestCase.EX_RUN_ERROR,
mock_method)
@mock.patch('os.makedirs', side_effect=OSError)
def test_main_makedirs_oserror(self, mock_method):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True):
- self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR,
+ self._test_main(testcase_base.TestCase.EX_RUN_ERROR,
mock_method)
@mock.patch('robot.run', side_effect=RobotError)
@@ -264,7 +264,7 @@ class ODLTesting(unittest.TestCase):
mock.patch.object(odl, 'open', mock.mock_open(),
create=True), \
self.assertRaises(RobotError):
- self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, *args)
+ self._test_main(testcase_base.TestCase.EX_RUN_ERROR, *args)
@mock.patch('robot.run')
@mock.patch('os.makedirs')
@@ -275,7 +275,7 @@ class ODLTesting(unittest.TestCase):
create=True), \
mock.patch.object(self.test, 'parse_results',
side_effect=RobotError):
- self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, *args)
+ self._test_main(testcase_base.TestCase.EX_RUN_ERROR, *args)
@mock.patch('os.remove', side_effect=Exception)
@mock.patch('robot.run')
@@ -285,7 +285,7 @@ class ODLTesting(unittest.TestCase):
return_value=True), \
mock.patch.object(self.test, 'parse_results'), \
self.assertRaises(Exception):
- self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
+ self._test_main(testcase_base.TestCase.EX_OK, *args)
@mock.patch('os.remove')
@mock.patch('robot.run')
@@ -296,7 +296,7 @@ class ODLTesting(unittest.TestCase):
mock.patch.object(odl, 'open', mock.mock_open(),
create=True), \
mock.patch.object(self.test, 'parse_results'):
- self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
+ self._test_main(testcase_base.TestCase.EX_OK, *args)
@mock.patch('os.remove')
@mock.patch('robot.run')
@@ -307,7 +307,7 @@ class ODLTesting(unittest.TestCase):
mock.patch.object(odl, 'open', mock.mock_open(),
create=True), \
mock.patch.object(self.test, 'parse_results'):
- self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
+ self._test_main(testcase_base.TestCase.EX_OK, *args)
@mock.patch('os.remove')
@mock.patch('robot.run', return_value=1)
@@ -318,7 +318,7 @@ class ODLTesting(unittest.TestCase):
mock.patch.object(odl, 'open', mock.mock_open(),
create=True), \
mock.patch.object(self.test, 'parse_results'):
- self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
+ self._test_main(testcase_base.TestCase.EX_OK, *args)
@mock.patch('os.remove', side_effect=OSError)
@mock.patch('robot.run')
@@ -329,16 +329,16 @@ class ODLTesting(unittest.TestCase):
mock.patch.object(odl, 'open', mock.mock_open(),
create=True), \
mock.patch.object(self.test, 'parse_results'):
- self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
+ self._test_main(testcase_base.TestCase.EX_OK, *args)
def _test_run_missing_env_var(self, var):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
side_effect=self._fake_url_for):
del os.environ[var]
self.assertEqual(self.test.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
- def _test_run(self, status=testcase_base.TestcaseBase.EX_OK,
+ def _test_run(self, status=testcase_base.TestCase.EX_OK,
exception=None, odlip="127.0.0.3", odlwebport="8080",
odlrestconfport="8181"):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
@@ -360,7 +360,7 @@ class ODLTesting(unittest.TestCase):
def _test_run_defining_multiple_suites(
self, suites,
- status=testcase_base.TestcaseBase.EX_OK,
+ status=testcase_base.TestCase.EX_OK,
exception=None, odlip="127.0.0.3", odlwebport="8080",
odlrestconfport="8181"):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
@@ -384,7 +384,7 @@ class ODLTesting(unittest.TestCase):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
side_effect=auth_plugins.MissingAuthPlugin()):
self.assertEqual(self.test.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
def test_run_missing_os_auth_url(self):
self._test_run_missing_env_var("OS_AUTH_URL")
@@ -400,14 +400,14 @@ class ODLTesting(unittest.TestCase):
def test_run_main_false(self):
os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
- self._test_run(testcase_base.TestcaseBase.EX_RUN_ERROR,
+ self._test_run(testcase_base.TestCase.EX_RUN_ERROR,
odlip=self._sdn_controller_ip,
odlwebport=self._odl_webport)
def test_run_main_exception(self):
with self.assertRaises(Exception):
os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
- self._test_run(status=testcase_base.TestcaseBase.EX_RUN_ERROR,
+ self._test_run(status=testcase_base.TestCase.EX_RUN_ERROR,
exception=Exception(),
odlip=self._sdn_controller_ip,
odlwebport=self._odl_webport)
@@ -416,11 +416,11 @@ class ODLTesting(unittest.TestCase):
with mock.patch('functest.utils.openstack_utils.get_endpoint',
side_effect=self._fake_url_for):
self.assertEqual(self.test.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
def test_run_without_installer_type(self):
os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
- self._test_run(testcase_base.TestcaseBase.EX_OK,
+ self._test_run(testcase_base.TestCase.EX_OK,
odlip=self._sdn_controller_ip,
odlwebport=self._odl_webport)
@@ -428,13 +428,13 @@ class ODLTesting(unittest.TestCase):
os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
self._test_run_defining_multiple_suites(
[odl.ODLTests.basic_suite_dir],
- testcase_base.TestcaseBase.EX_OK,
+ testcase_base.TestCase.EX_OK,
odlip=self._sdn_controller_ip,
odlwebport=self._odl_webport)
def test_run_fuel(self):
os.environ["INSTALLER_TYPE"] = "fuel"
- self._test_run(testcase_base.TestcaseBase.EX_OK,
+ self._test_run(testcase_base.TestCase.EX_OK,
odlip=self._neutron_ip, odlwebport='8282')
def test_run_apex_missing_sdn_controller_ip(self):
@@ -442,12 +442,12 @@ class ODLTesting(unittest.TestCase):
side_effect=self._fake_url_for):
os.environ["INSTALLER_TYPE"] = "apex"
self.assertEqual(self.test.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
def test_run_apex(self):
os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
os.environ["INSTALLER_TYPE"] = "apex"
- self._test_run(testcase_base.TestcaseBase.EX_OK,
+ self._test_run(testcase_base.TestCase.EX_OK,
odlip=self._sdn_controller_ip, odlwebport='8081',
odlrestconfport='8081')
@@ -456,12 +456,12 @@ class ODLTesting(unittest.TestCase):
side_effect=self._fake_url_for):
os.environ["INSTALLER_TYPE"] = "netvirt"
self.assertEqual(self.test.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
def test_run_netvirt(self):
os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip
os.environ["INSTALLER_TYPE"] = "netvirt"
- self._test_run(testcase_base.TestcaseBase.EX_OK,
+ self._test_run(testcase_base.TestCase.EX_OK,
odlip=self._sdn_controller_ip, odlwebport='8081',
odlrestconfport='8081')
@@ -470,17 +470,17 @@ class ODLTesting(unittest.TestCase):
side_effect=self._fake_url_for):
os.environ["INSTALLER_TYPE"] = "joid"
self.assertEqual(self.test.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
def test_run_joid(self):
os.environ["SDN_CONTROLLER"] = self._sdn_controller_ip
os.environ["INSTALLER_TYPE"] = "joid"
- self._test_run(testcase_base.TestcaseBase.EX_OK,
+ self._test_run(testcase_base.TestCase.EX_OK,
odlip=self._sdn_controller_ip, odlwebport='8080')
def test_run_compass(self, *args):
os.environ["INSTALLER_TYPE"] = "compass"
- self._test_run(testcase_base.TestcaseBase.EX_OK,
+ self._test_run(testcase_base.TestCase.EX_OK,
odlip=self._neutron_ip, odlwebport='8181')
def test_argparser_default(self):
diff --git a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py b/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py
index ad39be48..99e14b85 100644
--- a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py
+++ b/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py
@@ -378,13 +378,13 @@ class OSRallyTesting(unittest.TestCase):
mock.patch.object(self.rally_base, '_generate_report'), \
mock.patch.object(self.rally_base, '_clean_up'):
self.assertEqual(self.rally_base.run(),
- testcase_base.TestcaseBase.EX_OK)
+ testcase_base.TestCase.EX_OK)
def test_run_exception(self):
with mock.patch.object(self.rally_base, '_prepare_env',
side_effect=Exception):
self.assertEqual(self.rally_base.run(),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
if __name__ == "__main__":
diff --git a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py
index 4e83f6bf..4035b9c3 100644
--- a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py
+++ b/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py
@@ -70,7 +70,7 @@ class OSRefstackClientTesting(unittest.TestCase):
def _test_main_missing_keyword(self, key):
kwargs = self._get_main_kwargs(key)
self.assertEqual(self.refstackclient.main(**kwargs),
- testcase_base.TestcaseBase.EX_RUN_ERROR)
+ testcase_base.TestCase.EX_RUN_ERROR)
def test_main_missing_conf(self):
self._test_main_missing_keyword('config')
diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py b/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py
index 856cd143..56864b53 100644
--- a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py
@@ -119,7 +119,7 @@ class OSTempestTesting(unittest.TestCase):
mock_method.assert_any_call('test_case_name', 100)
def test_run_missing_create_tempest_dir(self):
- ret = testcase_base.TestcaseBase.EX_RUN_ERROR
+ ret = testcase_base.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.'
@@ -132,8 +132,8 @@ class OSTempestTesting(unittest.TestCase):
self.assertTrue(mock_os_makedirs.called)
def test_run_missing_configure_tempest(self):
- ret = testcase_base.TestcaseBase.EX_RUN_ERROR
- ret_ok = testcase_base.TestcaseBase.EX_OK
+ ret = testcase_base.TestCase.EX_RUN_ERROR
+ ret_ok = testcase_base.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.'
@@ -149,8 +149,8 @@ class OSTempestTesting(unittest.TestCase):
self.assertTrue(mock_os_makedirs.called)
def test_run_missing_generate_test_list(self):
- ret = testcase_base.TestcaseBase.EX_RUN_ERROR
- ret_ok = testcase_base.TestcaseBase.EX_OK
+ ret = testcase_base.TestCase.EX_RUN_ERROR
+ ret_ok = testcase_base.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.'
@@ -168,8 +168,8 @@ class OSTempestTesting(unittest.TestCase):
self.assertTrue(mock_os_makedirs.called)
def test_run_missing_apply_tempest_blacklist(self):
- ret = testcase_base.TestcaseBase.EX_RUN_ERROR
- ret_ok = testcase_base.TestcaseBase.EX_OK
+ ret = testcase_base.TestCase.EX_RUN_ERROR
+ ret_ok = testcase_base.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.'
@@ -189,8 +189,8 @@ class OSTempestTesting(unittest.TestCase):
self.assertTrue(mock_os_makedirs.called)
def test_run_missing_parse_verifier_result(self):
- ret = testcase_base.TestcaseBase.EX_RUN_ERROR
- ret_ok = testcase_base.TestcaseBase.EX_OK
+ ret = testcase_base.TestCase.EX_RUN_ERROR
+ ret_ok = testcase_base.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.'