aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-10-20 06:58:47 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-10-20 06:58:48 +0000
commit179beeb48c5d7f0eaf611652cc4b050bf9da7496 (patch)
tree37fc6df6328f7766bf79db97d6a7d062bfb5d9c9 /core
parent6eff0316f429c3af1c459740a7a7c869d8d3be98 (diff)
parent9cab15dfbac796fa1f5122bbea580e84411b73cf (diff)
Merge "Move unit tests in unit_tests"
Diffstat (limited to 'core')
-rwxr-xr-xcore/TestCasesBaseTesting.py80
1 files changed, 0 insertions, 80 deletions
diff --git a/core/TestCasesBaseTesting.py b/core/TestCasesBaseTesting.py
deleted file mode 100755
index fc9c2db60..000000000
--- a/core/TestCasesBaseTesting.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python
-
-import logging
-import mock
-import unittest
-
-from functest.core import TestCasesBase
-
-
-class TestCasesBaseTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- self.test = TestCasesBase.TestCasesBase()
- self.test.project = "functest"
- self.test.case_name = "base"
- self.test.start_time = "1"
- self.test.stop_time = "2"
- self.test.criteria = "100"
- self.test.details = {"Hello": "World"}
-
- def test_run_unimplemented(self):
- self.assertEqual(self.test.run(),
- TestCasesBase.TestCasesBase.EX_RUN_ERROR)
-
- @mock.patch('functest.utils.functest_utils.push_results_to_db',
- return_value=False)
- def _test_missing_attribute(self, mock_function):
- self.assertEqual(self.test.push_to_db(),
- TestCasesBase.TestCasesBase.EX_PUSH_TO_DB_ERROR)
- mock_function.assert_not_called()
-
- def test_missing_case_name(self):
- self.test.case_name = None
- self._test_missing_attribute()
-
- def test_missing_criteria(self):
- self.test.criteria = None
- self._test_missing_attribute()
-
- def test_missing_start_time(self):
- self.test.start_time = None
- self._test_missing_attribute()
-
- def test_missing_stop_time(self):
- self.test.stop_time = None
- self._test_missing_attribute()
-
- @mock.patch('functest.utils.functest_utils.push_results_to_db',
- return_value=True)
- def test_missing_details(self, mock_function):
- self.test.details = None
- self.assertEqual(self.test.push_to_db(),
- TestCasesBase.TestCasesBase.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)
-
- @mock.patch('functest.utils.functest_utils.push_results_to_db',
- return_value=False)
- def test_push_to_db_failed(self, mock_function):
- self.assertEqual(self.test.push_to_db(),
- TestCasesBase.TestCasesBase.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)
-
- @mock.patch('functest.utils.functest_utils.push_results_to_db',
- return_value=True)
- def test_push_to_db(self, mock_function):
- self.assertEqual(self.test.push_to_db(),
- TestCasesBase.TestCasesBase.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)
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)