Merge "[Tempest] Fix visibility of test_quotas.py module"
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
index a740e85..d6c47e5 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas_negative.py
@@ -13,6 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import ddt
 from tempest import config
 from tempest.lib import exceptions as lib_exc
 from testtools import testcase as tc
@@ -22,6 +23,7 @@
 CONF = config.CONF
 
 
+@ddt.ddt
 class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
 
     force_tenant_isolation = True
@@ -176,3 +178,28 @@
                           client.tenant_id,
                           client.user_id,
                           share_networks=bigger_value)
+
+    @ddt.data(
+        ('quota-sets', '2.0', 'show_quotas'),
+        ('quota-sets', '2.0', 'default_quotas'),
+        ('quota-sets', '2.0', 'reset_quotas'),
+        ('quota-sets', '2.0', 'update_quotas'),
+        ('quota-sets', '2.6', 'show_quotas'),
+        ('quota-sets', '2.6', 'default_quotas'),
+        ('quota-sets', '2.6', 'reset_quotas'),
+        ('quota-sets', '2.6', 'update_quotas'),
+        ('os-quota-sets', '2.7', 'show_quotas'),
+        ('os-quota-sets', '2.7', 'default_quotas'),
+        ('os-quota-sets', '2.7', 'reset_quotas'),
+        ('os-quota-sets', '2.7', 'update_quotas'),
+    )
+    @ddt.unpack
+    @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
+    @base.skip_if_microversion_not_supported("2.7")
+    def test_show_quotas_with_wrong_versions(self, url, version, method_name):
+        self.assertRaises(
+            lib_exc.NotFound,
+            getattr(self.shares_v2_client, method_name),
+            self.shares_v2_client.tenant_id,
+            version=version, url=url,
+        )
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index 6b48348..7bb727d 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -231,6 +231,14 @@
         super(BaseSharesTest, cls).setup_clients()
         os = getattr(cls, 'os_%s' % cls.credentials[0])
         os.shares_client = shares_client.SharesClient(os.auth_provider)
+
+        if CONF.identity.auth_version == 'v3':
+            project_id = os.auth_provider.auth_data[1]['project']['id']
+        else:
+            project_id = os.auth_provider.auth_data[1]['token']['tenant']['id']
+        cls.tenant_id = project_id
+        cls.user_id = os.auth_provider.auth_data[1]['user']['id']
+
         cls.shares_client = os.shares_client
         os.shares_v2_client = shares_v2_client.SharesV2Client(
             os.auth_provider)
diff --git a/manila_tempest_tests/tests/api/test_quotas.py b/manila_tempest_tests/tests/api/test_quotas.py
index 5209b1c..e9f5042 100644
--- a/manila_tempest_tests/tests/api/test_quotas.py
+++ b/manila_tempest_tests/tests/api/test_quotas.py
@@ -22,7 +22,7 @@
 CONF = config.CONF
 
 
-@ddt.data
+@ddt.ddt
 class SharesQuotasTest(base.BaseSharesTest):
 
     @classmethod
@@ -31,8 +31,8 @@
             msg = "Quota tests are disabled."
             raise cls.skipException(msg)
         super(SharesQuotasTest, cls).resource_setup()
-        cls.user_id = cls.shares_v2_client.user_id
-        cls.tenant_id = cls.shares_v2_client.tenant_id
+        cls.user_id = cls.shares_v2_client.user_id or cls.user_id
+        cls.tenant_id = cls.shares_v2_client.tenant_id or cls.tenant_id
 
     @tc.attr(base.TAG_POSITIVE, base.TAG_API)
     @ddt.data('shares_client', 'shares_v2_client')
diff --git a/manila_tempest_tests/tests/api/test_quotas_negative.py b/manila_tempest_tests/tests/api/test_quotas_negative.py
index ed4cf80..ca9882e 100644
--- a/manila_tempest_tests/tests/api/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/test_quotas_negative.py
@@ -13,7 +13,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import ddt
 from tempest import config
 from tempest.lib import exceptions as lib_exc
 from testtools import testcase as tc
@@ -23,7 +22,6 @@
 CONF = config.CONF
 
 
-@ddt.ddt
 class SharesQuotasNegativeTest(base.BaseSharesTest):
 
     @classmethod
@@ -50,28 +48,3 @@
                           self.shares_v2_client.update_quotas,
                           self.shares_v2_client.tenant_id,
                           shares=9)
-
-    @ddt.data(
-        ('services', '2.0', 'show_quotas'),
-        ('services', '2.0', 'default_quotas'),
-        ('services', '2.0', 'reset_quotas'),
-        ('services', '2.0', 'update_quotas'),
-        ('services', '2.6', 'show_quotas'),
-        ('services', '2.6', 'default_quotas'),
-        ('services', '2.6', 'reset_quotas'),
-        ('services', '2.6', 'update_quotas'),
-        ('os-services', '2.7', 'show_quotas'),
-        ('os-services', '2.7', 'default_quotas'),
-        ('os-services', '2.7', 'reset_quotas'),
-        ('os-services', '2.7', 'update_quotas'),
-    )
-    @ddt.unpack
-    @tc.attr(base.TAG_NEGATIVE, base.TAG_API)
-    @base.skip_if_microversion_not_supported("2.7")
-    def test_show_quotas_with_wrong_versions(self, url, version, method_name):
-        self.assertRaises(
-            lib_exc.NotFound,
-            getattr(self.shares_v2_client, method_name),
-            self.shares_v2_client.tenant_id,
-            version=version, url=url,
-        )