Better cleanup for Tempest tests

When running our Tempest tests, we are now cleaning up all the
objects we have created within the WatcherDB via a soft_delete.

Partially Implements: blueprint deletion-of-actions-plan

Change-Id: Ibdcfd2be37094377d09ad77d5c20298ee2baa4d0
This commit is contained in:
Vincent Françoise
2016-02-02 11:26:23 +01:00
parent a0b5f5aa1d
commit 79850cc89c
6 changed files with 127 additions and 56 deletions

View File

@@ -174,11 +174,6 @@ class InfraOptimClientJSON(base.BaseInfraOptimClient):
"""Lists details of all existing action plan"""
return self._list_request('/action_plans/detail', **kwargs)
@base.handle_errors
def list_action_plan_by_audit(self, audit_uuid):
"""Lists all action plans associated with an audit"""
return self._list_request('/action_plans', audit_uuid=audit_uuid)
@base.handle_errors
def show_action_plan(self, action_plan_uuid):
"""Gets a specific action plan
@@ -190,7 +185,7 @@ class InfraOptimClientJSON(base.BaseInfraOptimClient):
@base.handle_errors
def delete_action_plan(self, action_plan_uuid):
"""Deletes an action_plan having the specified UUID
"""Deletes an action plan having the specified UUID
:param action_plan_uuid: The unique identifier of the action_plan
:return: A tuple with the server response and the response body
@@ -198,6 +193,18 @@ class InfraOptimClientJSON(base.BaseInfraOptimClient):
return self._delete_request('/action_plans', action_plan_uuid)
@base.handle_errors
def delete_action_plans_by_audit(self, audit_uuid):
"""Deletes an action plan having the specified UUID
:param audit_uuid: The unique identifier of the related Audit
"""
_, action_plans = self.list_action_plans(audit_uuid=audit_uuid)
for action_plan in action_plans:
self.delete_action_plan(action_plan['uuid'])
@base.handle_errors
def update_action_plan(self, action_plan_uuid, patch):
"""Update the specified action plan