Best Python code snippet using tempest_python
test_quotas_negative.py
Source:test_quotas_negative.py
1# Copyright 2014 Mirantis Inc.2# All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License"); you may5# not use this file except in compliance with the License. You may obtain6# a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13# License for the specific language governing permissions and limitations14# under the License.15import ddt16from tempest import config17from tempest.lib import exceptions as lib_exc18from tempest import test19from manila_tempest_tests.tests.api import base20CONF = config.CONF21@ddt.ddt22class SharesQuotasNegativeTest(base.BaseSharesTest):23 @classmethod24 def resource_setup(cls):25 if not CONF.share.run_quota_tests:26 msg = "Quota tests are disabled."27 raise cls.skipException(msg)28 super(SharesQuotasNegativeTest, cls).resource_setup()29 @test.attr(type=["gate", "smoke", "negative"])30 def test_get_quotas_with_empty_tenant_id(self):31 self.assertRaises(lib_exc.NotFound,32 self.shares_v2_client.show_quotas, "")33 @test.attr(type=["gate", "smoke", "negative", ])34 def test_try_reset_quotas_with_user(self):35 self.assertRaises(lib_exc.Forbidden,36 self.shares_v2_client.reset_quotas,37 self.shares_v2_client.tenant_id)38 @test.attr(type=["gate", "smoke", "negative", ])39 def test_try_update_quotas_with_user(self):40 self.assertRaises(lib_exc.Forbidden,41 self.shares_v2_client.update_quotas,42 self.shares_v2_client.tenant_id,43 shares=9)44 @ddt.data(45 ('services', '2.0', 'show_quotas'),46 ('services', '2.0', 'default_quotas'),47 ('services', '2.0', 'reset_quotas'),48 ('services', '2.0', 'update_quotas'),49 ('services', '2.6', 'show_quotas'),50 ('services', '2.6', 'default_quotas'),51 ('services', '2.6', 'reset_quotas'),52 ('services', '2.6', 'update_quotas'),53 ('os-services', '2.7', 'show_quotas'),54 ('os-services', '2.7', 'default_quotas'),55 ('os-services', '2.7', 'reset_quotas'),56 ('os-services', '2.7', 'update_quotas'),57 )58 @ddt.unpack59 @test.attr(type=["gate", "smoke", "negative", ])60 @base.skip_if_microversion_not_supported("2.7")61 def test_show_quotas_with_wrong_versions(self, url, version, method_name):62 self.assertRaises(63 lib_exc.NotFound,64 getattr(self.shares_v2_client, method_name),65 self.shares_v2_client.tenant_id,66 version=version, url=url,...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!