From edc85151304274c52b19ece3f0df51758bd165ff Mon Sep 17 00:00:00 2001 From: Bartosz Zurkowski Date: Tue, 7 Aug 2018 17:52:31 +0200 Subject: [PATCH] Add common base class for test cases Adds a base class that includes parts common to API and scenario tests. Change-Id: I1485228520d641d94bf9a1f5c7bbb2a306b63bf2 Signed-off-by: Bartosz Zurkowski --- trove_tempest_plugin/tests/api/test_flavors.py | 4 ++-- .../tests/api/test_flavors_negative.py | 4 ++-- trove_tempest_plugin/tests/api/test_limits.py | 4 ++-- trove_tempest_plugin/tests/api/test_versions.py | 4 ++-- .../tests/{api/base.py => base_test.py} | 12 ++++++++---- 5 files changed, 16 insertions(+), 12 deletions(-) rename trove_tempest_plugin/tests/{api/base.py => base_test.py} (93%) diff --git a/trove_tempest_plugin/tests/api/test_flavors.py b/trove_tempest_plugin/tests/api/test_flavors.py index 8b81344..17a3106 100644 --- a/trove_tempest_plugin/tests/api/test_flavors.py +++ b/trove_tempest_plugin/tests/api/test_flavors.py @@ -17,10 +17,10 @@ from tempest.common import utils from tempest.lib import decorators from testtools import testcase as testtools -from trove_tempest_plugin.tests.api import base +from trove_tempest_plugin.tests import base_test -class DatabaseFlavorsTest(base.BaseDatabaseTest): +class DatabaseFlavorsTest(base_test.BaseDatabaseTest): @classmethod def setup_clients(cls): diff --git a/trove_tempest_plugin/tests/api/test_flavors_negative.py b/trove_tempest_plugin/tests/api/test_flavors_negative.py index 46d9187..6a798d8 100644 --- a/trove_tempest_plugin/tests/api/test_flavors_negative.py +++ b/trove_tempest_plugin/tests/api/test_flavors_negative.py @@ -18,10 +18,10 @@ from tempest.lib import decorators from tempest.lib import exceptions as lib_exc from testtools import testcase as testtools -from trove_tempest_plugin.tests.api import base +from trove_tempest_plugin.tests import base_test -class DatabaseFlavorsNegativeTest(base.BaseDatabaseTest): +class DatabaseFlavorsNegativeTest(base_test.BaseDatabaseTest): @classmethod def setup_clients(cls): diff --git a/trove_tempest_plugin/tests/api/test_limits.py b/trove_tempest_plugin/tests/api/test_limits.py index a3d2768..e85c284 100644 --- a/trove_tempest_plugin/tests/api/test_limits.py +++ b/trove_tempest_plugin/tests/api/test_limits.py @@ -16,10 +16,10 @@ from tempest.lib import decorators from testtools import testcase as testtools -from trove_tempest_plugin.tests.api import base +from trove_tempest_plugin.tests import base_test -class DatabaseLimitsTest(base.BaseDatabaseTest): +class DatabaseLimitsTest(base_test.BaseDatabaseTest): @classmethod def resource_setup(cls): diff --git a/trove_tempest_plugin/tests/api/test_versions.py b/trove_tempest_plugin/tests/api/test_versions.py index f88b8a4..52856fa 100644 --- a/trove_tempest_plugin/tests/api/test_versions.py +++ b/trove_tempest_plugin/tests/api/test_versions.py @@ -16,10 +16,10 @@ from tempest.lib import decorators from testtools import testcase as testtools -from trove_tempest_plugin.tests.api import base +from trove_tempest_plugin.tests import base_test -class DatabaseVersionsTest(base.BaseDatabaseTest): +class DatabaseVersionsTest(base_test.BaseDatabaseTest): @classmethod def setup_clients(cls): diff --git a/trove_tempest_plugin/tests/api/base.py b/trove_tempest_plugin/tests/base_test.py similarity index 93% rename from trove_tempest_plugin/tests/api/base.py rename to trove_tempest_plugin/tests/base_test.py index 04a71f9..2cef0c6 100644 --- a/trove_tempest_plugin/tests/api/base.py +++ b/trove_tempest_plugin/tests/base_test.py @@ -14,15 +14,20 @@ # under the License. from tempest import config -import tempest.test +from tempest import test from trove_tempest_plugin import clients CONF = config.CONF -class BaseDatabaseTest(tempest.test.BaseTestCase): - """Base test case class for all Database API tests.""" +class BaseDatabaseTest(test.BaseTestCase): + """Base test case class. + + Includes parts common to API and scenario tests: + * test case callbacks, + * service clients initialization. + """ credentials = ['primary'] client_manager = clients.Manager @@ -76,7 +81,6 @@ class BaseDatabaseTest(tempest.test.BaseTestCase): @classmethod def resource_setup(cls): super(BaseDatabaseTest, cls).resource_setup() - cls.catalog_type = CONF.database.catalog_type cls.db_flavor_ref = CONF.database.db_flavor_ref cls.db_current_version = CONF.database.db_current_version