summaryrefslogtreecommitdiffstats
path: root/unit_tests/core/test_base.py
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-11-08 14:18:12 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2016-11-09 16:55:45 +0100
commit107e61635c2ab1feb5263380ea63e21cf2e6e65b (patch)
tree4966b77605bd34a40f452b1d268868691e84d008 /unit_tests/core/test_base.py
parente74c9b347f2623eb1a3c477921a84da4c31b364f (diff)
Repo structure modification
- create functest subdirectory - rename unit tests - adapt path in exec and config files JIRA: FUNCTEST-525 Change-Id: Ifd5c6edfb5bda1b09f82848e2269ad5fbeb84d0a Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'unit_tests/core/test_base.py')
-rw-r--r--unit_tests/core/test_base.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/unit_tests/core/test_base.py b/unit_tests/core/test_base.py
deleted file mode 100644
index 25faca0aa..000000000
--- a/unit_tests/core/test_base.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2016 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
-
-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)