Fix create audit fail from audit_template

The name is a positional parameter in create() of audit,
but this parameter is not defined when calling from the
audit template. This patch fix it.

Related Bug: #1930565
Change-Id: Id18945b881d150f972dbbd5522010be0157fba17
This commit is contained in:
limin.lc 2021-06-03 10:32:49 +08:00 committed by limin0801
parent 427afe1f75
commit 2ee3c6015c
2 changed files with 5 additions and 5 deletions

View File

@ -62,8 +62,8 @@ class Audit(base.APIDictWrapper):
self._request = request
@classmethod
def create(cls, request, name, audit_template_uuid,
audit_type, auto_trigger=False, interval=None):
def create(cls, request, audit_template_uuid, audit_type, name=None,
auto_trigger=False, interval=None):
"""Create an audit in Watcher

View File

@ -222,7 +222,7 @@ class WatcherAPITests(test.APITestCase):
return_value=audit)
ret_val = api.watcher.Audit.create(
self.request, audit_name, audit_template_uuid, audit_type)
self.request, audit_template_uuid, audit_type, audit_name)
self.assertIsInstance(ret_val, dict)
watcherclient.audit.create.assert_called_with(
audit_template_uuid=audit_template_uuid,
@ -242,7 +242,7 @@ class WatcherAPITests(test.APITestCase):
return_value=audit)
ret_val = api.watcher.Audit.create(
self.request, audit_name, audit_template_uuid, audit_type,
self.request, audit_template_uuid, audit_type, audit_name,
False, interval)
self.assertIsInstance(ret_val, dict)
watcherclient.audit.create.assert_called_with(
@ -265,7 +265,7 @@ class WatcherAPITests(test.APITestCase):
return_value=audit)
ret_val = api.watcher.Audit.create(
self.request, audit_name, audit_template_uuid, audit_type, True)
self.request, audit_template_uuid, audit_type, audit_name, True)
self.assertIsInstance(ret_val, dict)
watcherclient.audit.create.assert_called_with(
audit_template_uuid=audit_template_uuid,