Fix field type to audit_type
There's a number of places where a field of an object is named "type", which isn't good thing. Actually type is keyword in python, so wherever I found type used in models/api/object/test, I have fixed it to audit_type in the audit files Change-Id: Ic09458b455820787f5483e48aed940a2196b297e Closes-Bug: #1533392
This commit is contained in:
parent
a6aed1772d
commit
75dd8dc561
|
@ -27,7 +27,7 @@ AUDIT1 = {
|
|||
'id': 1,
|
||||
'uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2',
|
||||
'deadline': None,
|
||||
'type': 'ONE_SHOT',
|
||||
'audit_type': 'ONE_SHOT',
|
||||
'audit_template_uuid': '770ef053-ecb3-48b0-85b5-d55a2dbc6588'
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ AUDIT2 = {
|
|||
'id': 2,
|
||||
'uuid': 'a5199d0e-0702-4613-9234-5ae2af8dafea',
|
||||
'deadline': None,
|
||||
'type': 'ONE_SHOT',
|
||||
'audit_type': 'ONE_SHOT',
|
||||
'audit_template_uuid': '770ef053-ecb3-48b0-85b5-d55a2dbc6588'
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ AUDIT_TEMPLATE_1 = {
|
|||
AUDIT_1 = {
|
||||
'uuid': '5869da81-4876-4687-a1ed-12cd64cf53d9',
|
||||
'deadline': None,
|
||||
'type': 'ONESHOT',
|
||||
'audit_type': 'ONESHOT',
|
||||
'state': 'PENDING',
|
||||
'audit_template_uuid': 'f8e47706-efcf-49a4-a5c4-af604eb492f2',
|
||||
'audit_template_name': 'at1',
|
||||
|
@ -53,7 +53,7 @@ AUDIT_1 = {
|
|||
AUDIT_2 = {
|
||||
'uuid': 'a5199d0e-0702-4613-9234-5ae2af8dafea',
|
||||
'deadline': None,
|
||||
'type': 'ONESHOT',
|
||||
'audit_type': 'ONESHOT',
|
||||
'audit_template_uuid': '770ef053-ecb3-48b0-85b5-d55a2dbc6588',
|
||||
'audit_template_name': 'at2',
|
||||
'state': 'PENDING',
|
||||
|
@ -225,7 +225,7 @@ class AuditShellTest(base.CommandTestCase):
|
|||
result)
|
||||
self.m_audit_mgr.create.assert_called_once_with(
|
||||
audit_template_uuid='f8e47706-efcf-49a4-a5c4-af604eb492f2',
|
||||
type='ONESHOT')
|
||||
audit_type='ONESHOT')
|
||||
|
||||
def test_do_audit_create_with_audit_template_name(self):
|
||||
audit = resource.Audit(mock.Mock(), AUDIT_1)
|
||||
|
@ -241,7 +241,7 @@ class AuditShellTest(base.CommandTestCase):
|
|||
result)
|
||||
self.m_audit_mgr.create.assert_called_once_with(
|
||||
audit_template_uuid='f8e47706-efcf-49a4-a5c4-af604eb492f2',
|
||||
type='ONESHOT')
|
||||
audit_type='ONESHOT')
|
||||
|
||||
def test_do_audit_create_with_deadline(self):
|
||||
audit = resource.Audit(mock.Mock(), AUDIT_1)
|
||||
|
@ -258,7 +258,7 @@ class AuditShellTest(base.CommandTestCase):
|
|||
result)
|
||||
self.m_audit_mgr.create.assert_called_once_with(
|
||||
audit_template_uuid='f8e47706-efcf-49a4-a5c4-af604eb492f2',
|
||||
type='ONESHOT',
|
||||
audit_type='ONESHOT',
|
||||
deadline='2016-04-28T10:48:32.064802')
|
||||
|
||||
def test_do_audit_create_with_type(self):
|
||||
|
@ -276,4 +276,4 @@ class AuditShellTest(base.CommandTestCase):
|
|||
result)
|
||||
self.m_audit_mgr.create.assert_called_once_with(
|
||||
audit_template_uuid='f8e47706-efcf-49a4-a5c4-af604eb492f2',
|
||||
type='ONESHOT')
|
||||
audit_type='ONESHOT')
|
||||
|
|
|
@ -189,9 +189,9 @@ class CreateActionPlan(command.ShowOne):
|
|||
metavar='<deadline>',
|
||||
help=_('Descrition of the audit.'))
|
||||
parser.add_argument(
|
||||
'-t', '--type',
|
||||
dest='type',
|
||||
metavar='<type>',
|
||||
'-t', '--audit_type',
|
||||
dest='audit_type',
|
||||
metavar='<audit_type>',
|
||||
default='ONESHOT',
|
||||
help=_("ActionPlan type."))
|
||||
|
||||
|
@ -200,7 +200,7 @@ class CreateActionPlan(command.ShowOne):
|
|||
def take_action(self, parsed_args):
|
||||
client = getattr(self.app.client_manager, "infra-optim")
|
||||
|
||||
field_list = ['audit_template_uuid', 'type', 'deadline']
|
||||
field_list = ['audit_template_uuid', 'audit_type', 'deadline']
|
||||
fields = dict((k, v) for (k, v) in vars(parsed_args).items()
|
||||
if k in field_list and v is not None)
|
||||
if fields.get('audit_template_uuid'):
|
||||
|
|
|
@ -18,7 +18,7 @@ from watcherclient.common import base
|
|||
from watcherclient.common import utils
|
||||
from watcherclient import exceptions as exc
|
||||
|
||||
CREATION_ATTRIBUTES = ['audit_template_uuid', 'deadline', 'type']
|
||||
CREATION_ATTRIBUTES = ['audit_template_uuid', 'deadline', 'audit_type']
|
||||
|
||||
|
||||
class Audit(base.Resource):
|
||||
|
|
|
@ -127,9 +127,9 @@ class CreateAudit(command.ShowOne):
|
|||
metavar='<deadline>',
|
||||
help=_('Descrition of the audit.'))
|
||||
parser.add_argument(
|
||||
'-t', '--type',
|
||||
dest='type',
|
||||
metavar='<type>',
|
||||
'-t', '--audit_type',
|
||||
dest='audit_type',
|
||||
metavar='<audit_type>',
|
||||
default='ONESHOT',
|
||||
help=_("Audit type."))
|
||||
|
||||
|
@ -138,7 +138,7 @@ class CreateAudit(command.ShowOne):
|
|||
def take_action(self, parsed_args):
|
||||
client = getattr(self.app.client_manager, "infra-optim")
|
||||
|
||||
field_list = ['audit_template_uuid', 'type', 'deadline']
|
||||
field_list = ['audit_template_uuid', 'audit_type', 'deadline']
|
||||
fields = dict((k, v) for (k, v) in vars(parsed_args).items()
|
||||
if k in field_list and v is not None)
|
||||
if fields.get('audit_template_uuid'):
|
||||
|
|
|
@ -34,16 +34,18 @@ AUDIT_TEMPLATE_SHORT_LIST_FIELD_LABELS = ['UUID', 'Name', 'Goal', 'Strategy']
|
|||
|
||||
# Audit
|
||||
AUDIT_FIELDS = ['uuid', 'created_at', 'updated_at', 'deleted_at',
|
||||
'deadline', 'state', 'type', 'audit_template_uuid',
|
||||
'deadline', 'state', 'audit_type', 'audit_template_uuid',
|
||||
'audit_template_name']
|
||||
|
||||
AUDIT_FIELD_LABELS = ['UUID', 'Created At', 'Updated At', 'Deleted At',
|
||||
'Deadline', 'State', 'Type', 'Audit Template uuid',
|
||||
'Deadline', 'State', 'Audit Type', 'Audit Template uuid',
|
||||
'Audit Template Name']
|
||||
|
||||
AUDIT_SHORT_LIST_FIELDS = ['uuid', 'type', 'audit_template_name', 'state']
|
||||
AUDIT_SHORT_LIST_FIELDS = [
|
||||
'uuid', 'audit_type', 'audit_template_name', 'state']
|
||||
|
||||
AUDIT_SHORT_LIST_FIELD_LABELS = ['UUID', 'Type', 'Audit Template', 'State']
|
||||
AUDIT_SHORT_LIST_FIELD_LABELS = [
|
||||
'UUID', 'Audit Type', 'Audit Template', 'State']
|
||||
|
||||
# Action Plan
|
||||
ACTION_PLAN_FIELDS = ['uuid', 'created_at', 'updated_at', 'deleted_at',
|
||||
|
|
Loading…
Reference in New Issue