Add parameters verification when Audit is being created

We have to check Audit Type and Audit State to make sure
these parameters are in valid status.

Also, we provide default states for the next attributes:

- 'audit_template' is required and should be either UUID or text field
- 'state' is readonly so it raises an error if submitted in POST
  and is set by default to PENDING
- 'deadline' is optional and should be a datetime
- 'type' is a required text field

Change-Id: I2a7e0deec0ee2040e86400b500bb0efd8eade564
Closes-Bug: #1532843
Closes-Bug: #1533210
This commit is contained in:
Alexander Chadin
2016-04-06 17:42:06 +03:00
parent 0f14b7635d
commit e52dc4f8aa
9 changed files with 67 additions and 40 deletions

View File

@@ -24,8 +24,8 @@ from oslo_log import log
from tempest import config
from tempest import exceptions
from tempest.lib.common.utils import data_utils
from tempest.scenario import manager
from tempest_lib.common.utils import data_utils
from watcher_tempest_plugin import infra_optim_clients as clients
@@ -114,7 +114,7 @@ class BaseInfraOptimScenarioTest(manager.ScenarioTest):
# ### AUDITS ### #
def create_audit(self, audit_template_uuid, type='ONESHOT',
state='PENDING', deadline=None):
state=None, deadline=None):
"""Wrapper utility for creating a test audit
:param audit_template_uuid: Audit Template UUID this audit will use