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:
@@ -16,8 +16,8 @@
|
||||
|
||||
import functools
|
||||
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest import test
|
||||
from tempest_lib.common.utils import data_utils
|
||||
|
||||
from watcher_tempest_plugin import infra_optim_clients as clients
|
||||
|
||||
@@ -157,7 +157,7 @@ class BaseInfraOptimTest(test.BaseTestCase):
|
||||
|
||||
@classmethod
|
||||
def create_audit(cls, 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
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
@@ -72,7 +71,6 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
|
||||
self.assertRaises(
|
||||
exceptions.BadRequest, self.create_audit, **audit_params)
|
||||
|
||||
@decorators.skip_because(bug="1532843")
|
||||
@test.attr(type='smoke')
|
||||
def test_create_audit_with_invalid_state(self):
|
||||
_, audit_template = self.create_audit_template()
|
||||
@@ -85,7 +83,6 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
|
||||
self.assertRaises(
|
||||
exceptions.BadRequest, self.create_audit, **audit_params)
|
||||
|
||||
@decorators.skip_because(bug="1533210")
|
||||
@test.attr(type='smoke')
|
||||
def test_create_audit_with_no_state(self):
|
||||
_, audit_template = self.create_audit_template()
|
||||
|
||||
Reference in New Issue
Block a user