Merge "Split resource_setup for identity tests"
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index dab092d..649ca34 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -23,9 +23,9 @@
 class TestDefaultProjectId (base.BaseIdentityV3AdminTest):
 
     @classmethod
-    def resource_setup(cls):
+    def setup_credentials(cls):
         cls.set_network_resources()
-        super(TestDefaultProjectId, cls).resource_setup()
+        super(TestDefaultProjectId, cls).setup_credentials()
 
     def _delete_domain(self, domain_id):
         # It is necessary to disable the domain before deleting,
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 2283c21..75cb6bd 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -21,10 +21,14 @@
 class EndPointsTestJSON(base.BaseIdentityV3AdminTest):
 
     @classmethod
-    def resource_setup(cls):
-        super(EndPointsTestJSON, cls).resource_setup()
+    def setup_clients(cls):
+        super(EndPointsTestJSON, cls).setup_clients()
         cls.identity_client = cls.client
         cls.client = cls.endpoints_client
+
+    @classmethod
+    def resource_setup(cls):
+        super(EndPointsTestJSON, cls).resource_setup()
         cls.service_ids = list()
         s_name = data_utils.rand_name('service-')
         s_type = data_utils.rand_name('type--')
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index cf41f9c..ff450e1 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -24,10 +24,14 @@
 class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
 
     @classmethod
-    def resource_setup(cls):
-        super(EndpointsNegativeTestJSON, cls).resource_setup()
+    def setup_clients(cls):
+        super(EndpointsNegativeTestJSON, cls).setup_clients()
         cls.identity_client = cls.client
         cls.client = cls.endpoints_client
+
+    @classmethod
+    def resource_setup(cls):
+        super(EndpointsNegativeTestJSON, cls).resource_setup()
         cls.service_ids = list()
         s_name = data_utils.rand_name('service-')
         s_type = data_utils.rand_name('type--')
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 6dfddb0..d4a83e2 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -20,10 +20,6 @@
 
 class GroupsV3TestJSON(base.BaseIdentityV3AdminTest):
 
-    @classmethod
-    def resource_setup(cls):
-        super(GroupsV3TestJSON, cls).resource_setup()
-
     @test.attr(type='smoke')
     def test_group_create_update_get(self):
         name = data_utils.rand_name('Group')
diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py
index 359c0cf..2ea7107 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -23,10 +23,14 @@
 class RegionsTestJSON(base.BaseIdentityV3AdminTest):
 
     @classmethod
+    def setup_clients(cls):
+        super(RegionsTestJSON, cls).setup_clients()
+        cls.client = cls.region_client
+
+    @classmethod
     def resource_setup(cls):
         super(RegionsTestJSON, cls).resource_setup()
         cls.setup_regions = list()
-        cls.client = cls.region_client
         for i in range(2):
             r_description = data_utils.rand_name('description-')
             region = cls.client.create_region(r_description)
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 8f07a6a..ce54baa 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -29,8 +29,8 @@
 class BaseIdentityAdminTest(tempest.test.BaseTestCase):
 
     @classmethod
-    def resource_setup(cls):
-        super(BaseIdentityAdminTest, cls).resource_setup()
+    def setup_credentials(cls):
+        super(BaseIdentityAdminTest, cls).setup_credentials()
         cls.os_adm = clients.AdminManager()
         cls.os = clients.Manager()
 
@@ -72,18 +72,27 @@
 class BaseIdentityV2AdminTest(BaseIdentityAdminTest):
 
     @classmethod
-    def resource_setup(cls):
+    def skip_checks(cls):
+        super(BaseIdentityV2AdminTest, cls).skip_checks()
         if not CONF.identity_feature_enabled.api_v2:
             raise cls.skipException("Identity api v2 is not enabled")
-        super(BaseIdentityV2AdminTest, cls).resource_setup()
+
+    @classmethod
+    def setup_clients(cls):
+        super(BaseIdentityV2AdminTest, cls).setup_clients()
         cls.client = cls.os_adm.identity_client
         cls.token_client = cls.os_adm.token_client
         if not cls.client.has_admin_extensions():
             raise cls.skipException("Admin extensions disabled")
-        cls.data = DataGenerator(cls.client)
+
         cls.non_admin_client = cls.os.identity_client
 
     @classmethod
+    def resource_setup(cls):
+        super(BaseIdentityV2AdminTest, cls).resource_setup()
+        cls.data = DataGenerator(cls.client)
+
+    @classmethod
     def resource_cleanup(cls):
         cls.data.teardown_all()
         super(BaseIdentityV2AdminTest, cls).resource_cleanup()
@@ -92,10 +101,14 @@
 class BaseIdentityV3AdminTest(BaseIdentityAdminTest):
 
     @classmethod
-    def resource_setup(cls):
+    def skip_checks(cls):
+        super(BaseIdentityV3AdminTest, cls).skip_checks()
         if not CONF.identity_feature_enabled.api_v3:
             raise cls.skipException("Identity api v3 is not enabled")
-        super(BaseIdentityV3AdminTest, cls).resource_setup()
+
+    @classmethod
+    def setup_clients(cls):
+        super(BaseIdentityV3AdminTest, cls).setup_clients()
         cls.client = cls.os_adm.identity_v3_client
         cls.token = cls.os_adm.token_v3_client
         cls.endpoints_client = cls.os_adm.endpoints_client