mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Unit test added.
This commit is contained in:
parent
95e41e078c
commit
90bcc3d6ab
@ -311,9 +311,8 @@ class JobTemplate(UnifiedJobTemplate, JobOptions, SurveyJobTemplateMixin, Resour
|
||||
variables_needed = True
|
||||
prompting_needed = False
|
||||
for key, value in self._ask_for_vars_dict().iteritems():
|
||||
if value and not (key == 'extra_vars'
|
||||
and callback_extra_vars is not None
|
||||
and not variables_needed):
|
||||
if value and not (key == 'extra_vars' and
|
||||
callback_extra_vars is not None):
|
||||
prompting_needed = True
|
||||
return (not prompting_needed and
|
||||
not self.passwords_needed_to_start and
|
||||
|
||||
@ -115,3 +115,16 @@ def test_job_template_survey_mixin_length(job_template_factory):
|
||||
{'type':'password', 'variable':'my_other_variable'}]}
|
||||
kwargs = obj._update_unified_job_kwargs(extra_vars={'my_variable':'$encrypted$'})
|
||||
assert kwargs['extra_vars'] == '{"my_variable": "my_default"}'
|
||||
|
||||
|
||||
def test_job_template_can_start_with_callback_extra_vars_provided(job_template_factory):
|
||||
objects = job_template_factory(
|
||||
'callback_extra_vars_test',
|
||||
organization='org1',
|
||||
inventory='inventory1',
|
||||
credential='cred1',
|
||||
persisted=False,
|
||||
)
|
||||
obj = objects.job_template
|
||||
obj.ask_variables_on_launch = True
|
||||
assert obj.can_start_without_user_input(callback_extra_vars='{"foo": "bar"}') is True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user