Fix test_quotas

The change I1cd91b5e06bd17f9aac97bba71228f2e5c48879b modified the
delete_tenant_quota() function: it now raises a NotFound error if
delete failed.

Fix the test: catch and ignore the NotFound exception. The test
removes the quota by reseting quotas of the tenant.

Change-Id: I87df52474014c4bceff8124a627f829f6b625ce0
Closes-Bug: #1572592
This commit is contained in:
Victor Stinner 2016-04-20 16:46:27 +02:00 committed by Brandon Logan
parent 98403aba44
commit c5cbd394e1
1 changed files with 10 additions and 2 deletions

View File

@ -14,8 +14,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from tempest import test
from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
from tempest import test
from neutron_lbaas.tests.tempest.v1.api import base from neutron_lbaas.tests.tempest.v1.api import base
@ -59,7 +60,14 @@ class QuotasTest(base.BaseAdminNetworkTest):
# Change quotas for tenant # Change quotas for tenant
quota_set = self.admin_client.update_quotas(tenant_id, quota_set = self.admin_client.update_quotas(tenant_id,
**new_quotas) **new_quotas)
self.addCleanup(self.admin_client.reset_quotas, tenant_id)
def safe_reset_quotas(tenant_id):
try:
self.admin_client.reset_quotas(tenant_id)
except exceptions.NotFound:
pass
self.addCleanup(safe_reset_quotas, tenant_id)
for key, value in new_quotas.items(): for key, value in new_quotas.items():
self.assertEqual(value, quota_set[key]) self.assertEqual(value, quota_set[key])