aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2016-12-16 09:58:00 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-16 09:58:00 +0000
commit9251dcc0c689edc182ab7ae5a7fabc7da6544eca (patch)
treedf71e10ea2613fd904a89a7577bbf809ef35d47f /functest/tests/unit
parente9062a334bf73c19f3de74465209eaf099c46a26 (diff)
parent0d875d44c3d67e049c165365add1084467143b62 (diff)
Merge "Add check_criteria() in testcase_base"
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/core/test_testcase_base.py17
-rw-r--r--[-rwxr-xr-x]functest/tests/unit/odl/test_odl.py12
2 files changed, 20 insertions, 9 deletions
diff --git a/functest/tests/unit/core/test_testcase_base.py b/functest/tests/unit/core/test_testcase_base.py
index fe7b0d05..181eed94 100644
--- a/functest/tests/unit/core/test_testcase_base.py
+++ b/functest/tests/unit/core/test_testcase_base.py
@@ -24,7 +24,7 @@ class TestcaseBaseTesting(unittest.TestCase):
self.test.case_name = "base"
self.test.start_time = "1"
self.test.stop_time = "2"
- self.test.criteria = "100"
+ self.test.criteria = "PASS"
self.test.details = {"Hello": "World"}
def test_run_unimplemented(self):
@@ -82,6 +82,21 @@ class TestcaseBaseTesting(unittest.TestCase):
self.test.project, self.test.case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
+ def test_check_criteria_missing(self):
+ self.test.criteria = None
+ self.assertEqual(self.test.check_criteria(),
+ testcase_base.TestcaseBase.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)
+
+ def test_check_criteria_pass(self):
+ self.test.criteria = 'PASS'
+ self.assertEqual(self.test.check_criteria(),
+ testcase_base.TestcaseBase.EX_OK)
+
if __name__ == "__main__":
unittest.main(verbosity=2)
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index c29bfd7f..9a63ffb0 100755..100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -192,8 +192,7 @@ class ODLTesting(unittest.TestCase):
def test_main(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'parse_results',
- return_value="PASS"):
+ mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
@mock.patch('os.remove')
@@ -202,8 +201,7 @@ class ODLTesting(unittest.TestCase):
def test_main_makedirs_oserror17(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'parse_results',
- return_value="PASS"):
+ mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
@mock.patch('os.remove')
@@ -212,8 +210,7 @@ class ODLTesting(unittest.TestCase):
def test_main_testcases_in_failure(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'parse_results',
- return_value="PASS"):
+ mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
@mock.patch('os.remove', side_effect=OSError)
@@ -222,8 +219,7 @@ class ODLTesting(unittest.TestCase):
def test_main_remove_oserror(self, *args):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'parse_results',
- return_value="PASS"):
+ mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase_base.TestcaseBase.EX_OK, *args)
def _test_run_missing_env_var(self, var):