mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Allow setting identifier for approval nodes
This commit is contained in:
parent
29b567d6e1
commit
dbe3863b04
@ -3611,9 +3611,11 @@ class LaunchConfigurationBaseSerializer(BaseSerializer):
|
||||
elif self.instance:
|
||||
ujt = self.instance.unified_job_template
|
||||
if ujt is None:
|
||||
if 'workflow_job_template' in attrs:
|
||||
return {'workflow_job_template': attrs['workflow_job_template']}
|
||||
return {}
|
||||
ret = {}
|
||||
for fd in ('workflow_job_template', 'identifier'):
|
||||
if fd in attrs:
|
||||
ret[fd] = attrs[fd]
|
||||
return ret
|
||||
|
||||
# build additional field survey_passwords to track redacted variables
|
||||
password_dict = {}
|
||||
|
||||
@ -47,10 +47,35 @@ def test_create_workflow_job_template_node(run_module, admin_user, wfjt, job_tem
|
||||
"changed": True
|
||||
}
|
||||
|
||||
assert node.identifier == this_identifier
|
||||
assert node.workflow_job_template_id == wfjt.id
|
||||
assert node.unified_job_template_id == job_template.id
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_workflow_job_template_node_no_template(run_module, admin_user, wfjt, job_template):
|
||||
"""This is a part of the API contract for creating approval nodes
|
||||
and at some point in the future, tha feature will be supported by the collection
|
||||
"""
|
||||
this_identifier = '42🐉'
|
||||
result = run_module('tower_workflow_job_template_node', {
|
||||
'identifier': this_identifier,
|
||||
'workflow_job_template': wfjt.name,
|
||||
'organization': wfjt.organization.name,
|
||||
}, admin_user)
|
||||
assert not result.get('failed', False), result.get('msg', result)
|
||||
assert result.get('changed', False), result
|
||||
|
||||
node = WorkflowJobTemplateNode.objects.get(pk=result['id'])
|
||||
# node = WorkflowJobTemplateNode.objects.first()
|
||||
|
||||
assert result['id'] == node.id
|
||||
|
||||
assert node.identifier == this_identifier
|
||||
assert node.workflow_job_template_id == wfjt.id
|
||||
assert node.unified_job_template_id is None
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_make_use_of_prompts(run_module, admin_user, wfjt, job_template, machine_credential, vault_credential):
|
||||
result = run_module('tower_workflow_job_template_node', {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user