aboutsummaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2017-12-19 07:51:44 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-12-19 07:51:44 +0000
commit41380d84c1b9e90383f32d967b2d641a94516d1c (patch)
treee30744ad53e61b1c6ce7d8d0acaab89baa521cdb /functest
parente38c497a0ba3d062fca7f5e7bae9ca395005df34 (diff)
parent840e69fde9c86df109e777ec4e31ec1785020176 (diff)
Merge "Remove OSGCTestCase"
Diffstat (limited to 'functest')
-rw-r--r--functest/core/testcase.py35
-rw-r--r--functest/tests/unit/core/test_testcase.py46
2 files changed, 5 insertions, 76 deletions
diff --git a/functest/core/testcase.py b/functest/core/testcase.py
index a7dc47c4..ae0da9d7 100644
--- a/functest/core/testcase.py
+++ b/functest/core/testcase.py
@@ -12,11 +12,10 @@
import logging
import os
+import functest.utils.functest_utils as ft_utils
+
import prettytable
-import functest.utils.functest_utils as ft_utils
-import functest.utils.openstack_clean as os_clean
-import functest.utils.openstack_snapshot as os_snapshot
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@@ -196,33 +195,3 @@ class TestCase(object):
It can be overriden if resources must be deleted after
running the test case.
"""
-
-
-class OSGCTestCase(TestCase):
- """Model for single test case which requires an OpenStack Garbage
- Collector."""
-
- __logger = logging.getLogger(__name__)
-
- def create_snapshot(self):
- """Create a snapshot listing the OpenStack resources.
-
- Returns:
- TestCase.EX_OK if os_snapshot.main() returns 0.
- TestCase.EX_RUN_ERROR otherwise.
- """
- try:
- assert os_snapshot.main() == 0
- self.__logger.info("OpenStack resources snapshot created")
- return TestCase.EX_OK
- except Exception: # pylint: disable=broad-except
- self.__logger.exception("Cannot create the snapshot")
- return TestCase.EX_RUN_ERROR
-
- def clean(self):
- """Clean the OpenStack resources."""
- try:
- assert os_clean.main() == 0
- self.__logger.info("OpenStack resources cleaned")
- except Exception: # pylint: disable=broad-except
- self.__logger.exception("Cannot clean the OpenStack resources")
diff --git a/functest/tests/unit/core/test_testcase.py b/functest/tests/unit/core/test_testcase.py
index 0a6f0c9f..6fbf62e2 100644
--- a/functest/tests/unit/core/test_testcase.py
+++ b/functest/tests/unit/core/test_testcase.py
@@ -12,15 +12,17 @@
import logging
import unittest
+from functest.core import testcase
+
import mock
-from functest.core import testcase
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
class TestCaseTesting(unittest.TestCase):
"""The class testing TestCase."""
+
# pylint: disable=missing-docstring,too-many-public-methods
_case_name = "base"
@@ -229,48 +231,6 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.clean(), None)
-class OSGCTestCaseTesting(unittest.TestCase):
- """The class testing OSGCTestCase."""
- # pylint: disable=missing-docstring
-
- def setUp(self):
- self.test = testcase.OSGCTestCase()
-
- @mock.patch('functest.utils.openstack_snapshot.main',
- side_effect=Exception)
- def test_create_snapshot_exc(self, mock_method=None):
- self.assertEqual(self.test.create_snapshot(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_method.assert_called_once_with()
-
- @mock.patch('functest.utils.openstack_snapshot.main', return_value=-1)
- def test_create_snapshot_ko(self, mock_method=None):
- self.assertEqual(self.test.create_snapshot(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_method.assert_called_once_with()
-
- @mock.patch('functest.utils.openstack_snapshot.main', return_value=0)
- def test_create_snapshot_env(self, mock_method=None):
- self.assertEqual(self.test.create_snapshot(),
- testcase.TestCase.EX_OK)
- mock_method.assert_called_once_with()
-
- @mock.patch('functest.utils.openstack_clean.main', side_effect=Exception)
- def test_clean_exc(self, mock_method=None):
- self.assertEqual(self.test.clean(), None)
- mock_method.assert_called_once_with()
-
- @mock.patch('functest.utils.openstack_clean.main', return_value=-1)
- def test_clean_ko(self, mock_method=None):
- self.assertEqual(self.test.clean(), None)
- mock_method.assert_called_once_with()
-
- @mock.patch('functest.utils.openstack_clean.main', return_value=0)
- def test_clean(self, mock_method=None):
- self.assertEqual(self.test.clean(), None)
- mock_method.assert_called_once_with()
-
-
if __name__ == "__main__":
logging.disable(logging.CRITICAL)
unittest.main(verbosity=2)