summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsean-m-ssullivan <ssulliva@redhat.com>2021-04-28 02:32:21 +0200
committersean-m-ssullivan <ssulliva@redhat.com>2021-04-28 02:32:21 +0200
commitc22c0a393c0d9ca37136016f4720db76efc2fea2 (patch)
tree59abfa6c2b5b5c9d63bb4f22361d58aa97128b8b
parentMerge pull request #10032 from nixocio/ui_update_timeout (diff)
downloadawx-c22c0a393c0d9ca37136016f4720db76efc2fea2.tar.xz
awx-c22c0a393c0d9ca37136016f4720db76efc2fea2.zip
update tests and survey change status
-rw-r--r--awx_collection/plugins/modules/tower_workflow_job_template.py2
-rw-r--r--awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml118
2 files changed, 119 insertions, 1 deletions
diff --git a/awx_collection/plugins/modules/tower_workflow_job_template.py b/awx_collection/plugins/modules/tower_workflow_job_template.py
index 4e38d4976d..2febda3b04 100644
--- a/awx_collection/plugins/modules/tower_workflow_job_template.py
+++ b/awx_collection/plugins/modules/tower_workflow_job_template.py
@@ -809,7 +809,7 @@ def main():
existing_spec = None
if existing_item:
spec_endpoint = existing_item.get('related', {}).get('survey_spec')
- existing_spec = module.get_endpoint(spec_endpoint)
+ existing_spec = module.get_endpoint(spec_endpoint)['json']
if new_spec != existing_spec:
module.json_output['changed'] = True
if existing_item and module.has_encrypted_values(existing_spec):
diff --git a/awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml
index 5e9e9159f0..cb8be5a06b 100644
--- a/awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml
+++ b/awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml
@@ -300,6 +300,124 @@
that:
- "result is changed"
+- name: Add Survey to Copied workflow job template
+ tower_workflow_job_template:
+ name: "copy_{{ wfjt_name }}"
+ organization: Default
+ survey_spec:
+ name: Basic Survey
+ description: Basic Survey
+ spec:
+ - question_description: Name
+ min: 0
+ default: ''
+ max: 128
+ required: true
+ choices: ''
+ new_question: true
+ variable: basic_name
+ question_name: Basic Name
+ type: text
+ - question_description: Choosing yes or no.
+ min: 0
+ default: 'yes'
+ max: 0
+ required: true
+ choices: |-
+ yes
+ no
+ new_question: true
+ variable: option_true_false
+ question_name: Choose yes or no?
+ type: multiplechoice
+ - question_description: ''
+ min: 0
+ default: ''
+ max: 0
+ required: true
+ choices: |-
+ group1
+ group2
+ group3
+ new_question: true
+ variable: target_groups
+ question_name: 'Select Group:'
+ type: multiselect
+ - question_name: password
+ question_description: ''
+ required: true
+ type: password
+ variable: password
+ min: 0
+ max: 1024
+ default: ''
+ choices: ''
+ new_question: true
+ register: result
+
+- assert:
+ that:
+ - "result is changed"
+
+- name: Re add survey to workflow job template expected not changed.
+ tower_workflow_job_template:
+ name: "copy_{{ wfjt_name }}"
+ organization: Default
+ survey_spec:
+ name: Basic Survey
+ description: Basic Survey
+ spec:
+ - question_description: Name
+ min: 0
+ default: ''
+ max: 128
+ required: true
+ choices: ''
+ new_question: true
+ variable: basic_name
+ question_name: Basic Name
+ type: text
+ - question_description: Choosing yes or no.
+ min: 0
+ default: 'yes'
+ max: 0
+ required: true
+ choices: |-
+ yes
+ no
+ new_question: true
+ variable: option_true_false
+ question_name: Choose yes or no?
+ type: multiplechoice
+ - question_description: ''
+ min: 0
+ default: ''
+ max: 0
+ required: true
+ choices: |-
+ group1
+ group2
+ group3
+ new_question: true
+ variable: target_groups
+ question_name: 'Select Group:'
+ type: multiselect
+ - question_name: password
+ question_description: ''
+ required: true
+ type: password
+ variable: password
+ min: 0
+ max: 1024
+ default: ''
+ choices: ''
+ new_question: true
+ register: result
+
+- assert:
+ that:
+ - "result is not changed"
+
- name: Delete copied workflow job template
tower_workflow_job_template:
name: "copy_{{ wfjt_name }}"