Add create EVENT audit functional test

Change-Id: Iab3b667912278fc2b693dbccf980d102d85d8ea5
This commit is contained in:
licanwei 2020-02-18 15:11:42 +08:00
parent d1517415db
commit baa59e75f8

View File

@ -93,6 +93,41 @@ class TestCreateUpdateDeleteAudit(base.BaseInfraOptimTest):
_, audit = self.client.show_audit(body['uuid']) _, audit = self.client.show_audit(body['uuid'])
self.assertEqual(audit['state'], 'CANCELLED') self.assertEqual(audit['state'], 'CANCELLED')
@decorators.attr(type='smoke')
def test_create_audit_event(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
audit_params = dict(
audit_template_uuid=audit_template['uuid'],
audit_type='EVENT',
name='audit_event',
)
_, body = self.create_audit(**audit_params)
audit_params.pop('audit_template_uuid')
audit_params['goal_uuid'] = goal['uuid']
self.assert_expected(audit_params, body)
self.assertEqual(body['state'], 'PENDING')
_, audit = self.client.show_audit(body['uuid'])
self.assert_expected(audit, body)
_, audit = self.update_audit(
body['uuid'],
[{'op': 'replace', 'path': '/state', 'value': 'CANCELLED'}]
)
test_utils.call_until_true(
func=functools.partial(
self.is_audit_idle, body['uuid']),
duration=10,
sleep_for=.5
)
_, audit = self.client.show_audit(body['uuid'])
self.assertEqual(audit['state'], 'CANCELLED')
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
def test_create_audit_with_wrong_audit_template(self): def test_create_audit_with_wrong_audit_template(self):
audit_params = dict( audit_params = dict(