Merge "[Tempest] Fix visibility of test_quotas.py module"

This commit is contained in:
Jenkins 2016-11-02 20:02:18 +00:00 committed by Gerrit Code Review
commit ef91e54df4
4 changed files with 38 additions and 30 deletions

@ -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 @@ from manila_tempest_tests.tests.api import base
CONF = config.CONF
@ddt.ddt
class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
force_tenant_isolation = True
@ -176,3 +178,28 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
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,
)

@ -231,6 +231,14 @@ class BaseSharesTest(test.BaseTestCase):
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)

@ -22,7 +22,7 @@ from manila_tempest_tests.tests.api import base
CONF = config.CONF
@ddt.data
@ddt.ddt
class SharesQuotasTest(base.BaseSharesTest):
@classmethod
@ -31,8 +31,8 @@ class SharesQuotasTest(base.BaseSharesTest):
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')

@ -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 @@ from manila_tempest_tests.tests.api import base
CONF = config.CONF
@ddt.ddt
class SharesQuotasNegativeTest(base.BaseSharesTest):
@classmethod
@ -50,28 +48,3 @@ class SharesQuotasNegativeTest(base.BaseSharesTest):
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,
)