mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 18:21:12 +03:00
Unit test added.
This commit is contained in:
parent
51cd9e99e6
commit
535f979fd7
@ -50,3 +50,32 @@ def test_job_template_survey_password_redaction(job_template_with_survey_passwor
|
|||||||
"""Tests the JobTemplate model's funciton to redact passwords from
|
"""Tests the JobTemplate model's funciton to redact passwords from
|
||||||
extra_vars - used when creating a new job"""
|
extra_vars - used when creating a new job"""
|
||||||
assert job_template_with_survey_passwords_unit.survey_password_variables() == ['secret_key', 'SSN']
|
assert job_template_with_survey_passwords_unit.survey_password_variables() == ['secret_key', 'SSN']
|
||||||
|
|
||||||
|
def test_job_template_survey_variable_validation(job_template_factory):
|
||||||
|
objects = job_template_factory(
|
||||||
|
'survey_variable_validation',
|
||||||
|
organization='org1',
|
||||||
|
inventory='inventory1',
|
||||||
|
credential='cred1',
|
||||||
|
persisted=False,
|
||||||
|
)
|
||||||
|
obj = objects.job_template
|
||||||
|
obj.survey_spec = {
|
||||||
|
"description": "",
|
||||||
|
"spec": [
|
||||||
|
{
|
||||||
|
"required": True,
|
||||||
|
"min": 0,
|
||||||
|
"default": "5",
|
||||||
|
"max": 1024,
|
||||||
|
"question_description": "",
|
||||||
|
"choices": "",
|
||||||
|
"variable": "a",
|
||||||
|
"question_name": "Whosyourdaddy",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
obj.survey_enabled = True
|
||||||
|
assert obj.survey_variable_validation({"a": 5}) == ["Value 5 for 'a' expected to be a string."]
|
||||||
|
Loading…
Reference in New Issue
Block a user