Cleanup database after functional test runs
Ensure all quota related database entries are deleted after running functional tests. Change-Id: Ib51bc66cab7c173cf8d7e77a587d599100b70386 Implements: blueprint quota-support-on-barbican-resources
This commit is contained in:
parent
9835bd0027
commit
96dbfd447a
@ -101,6 +101,7 @@ class QuotaBehaviors(base_behaviors.BaseBehaviors):
|
|||||||
extra_headers=extra_headers,
|
extra_headers=extra_headers,
|
||||||
use_auth=use_auth, user_name=user_name)
|
use_auth=use_auth, user_name=user_name)
|
||||||
|
|
||||||
|
if resp.status_code == 204:
|
||||||
self.created_entities.append((project_id, user_name))
|
self.created_entities.append((project_id, user_name))
|
||||||
|
|
||||||
return resp
|
return resp
|
||||||
@ -120,7 +121,7 @@ class QuotaBehaviors(base_behaviors.BaseBehaviors):
|
|||||||
extra_headers=extra_headers,
|
extra_headers=extra_headers,
|
||||||
use_auth=use_auth, user_name=user_name)
|
use_auth=use_auth, user_name=user_name)
|
||||||
|
|
||||||
if not expected_fail:
|
if resp.status_code == 204:
|
||||||
for item in self.created_entities:
|
for item in self.created_entities:
|
||||||
if item[0] == project_id:
|
if item[0] == project_id:
|
||||||
self.created_entities.remove(item)
|
self.created_entities.remove(item)
|
||||||
|
@ -39,8 +39,8 @@ class QuotasTestCase(base.TestCase):
|
|||||||
CONF.identity.username)
|
CONF.identity.username)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(QuotasTestCase, self).tearDown()
|
|
||||||
self.behaviors.delete_all_created_quotas()
|
self.behaviors.delete_all_created_quotas()
|
||||||
|
super(QuotasTestCase, self).tearDown()
|
||||||
|
|
||||||
def test_get_quotas_with_defaults(self):
|
def test_get_quotas_with_defaults(self):
|
||||||
"""Get effective quota information for own project"""
|
"""Get effective quota information for own project"""
|
||||||
|
@ -98,6 +98,7 @@ class RBACQuotasTestCase(base.TestCase):
|
|||||||
self.project_id = self.behaviors.get_project_id_from_name('admin')
|
self.project_id = self.behaviors.get_project_id_from_name('admin')
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
self.behaviors.delete_all_created_quotas()
|
||||||
super(RBACQuotasTestCase, self).tearDown()
|
super(RBACQuotasTestCase, self).tearDown()
|
||||||
|
|
||||||
@utils.parameterized_dataset(test_data_rbac_get_quotas)
|
@utils.parameterized_dataset(test_data_rbac_get_quotas)
|
||||||
@ -157,6 +158,11 @@ class RBACQuotasTestCase(base.TestCase):
|
|||||||
:param admin: the admin of the group owning quotas
|
:param admin: the admin of the group owning quotas
|
||||||
:param expected_return: the expected http return code
|
:param expected_return: the expected http return code
|
||||||
"""
|
"""
|
||||||
|
request_model = quota_models.ProjectQuotaRequestModel(
|
||||||
|
**get_set_project_quotas_request())
|
||||||
|
resp = self.behaviors.set_project_quotas(
|
||||||
|
self.project_id, request_model,
|
||||||
|
user_name=CONF.identity.service_admin)
|
||||||
resp = self.behaviors.delete_project_quotas(self.project_id,
|
resp = self.behaviors.delete_project_quotas(self.project_id,
|
||||||
user_name=user)
|
user_name=user)
|
||||||
self.assertEqual(expected_return, resp.status_code)
|
self.assertEqual(expected_return, resp.status_code)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user