mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-23 00:11:48 -05:00
Merge pull request #574 from ryanpetrello/fix-7764
properly perform validation on encrypted survey defaults
This commit is contained in:
@@ -8,6 +8,7 @@ from awx.main.models import (
|
||||
JobTemplate,
|
||||
WorkflowJobTemplate
|
||||
)
|
||||
from awx.main.utils.encryption import encrypt_value
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -143,6 +144,21 @@ def test_optional_survey_question_defaults(
|
||||
assert 'c' not in defaulted_extra_vars['extra_vars']
|
||||
|
||||
|
||||
@pytest.mark.survey
|
||||
def test_encrypted_default_validation(survey_spec_factory):
|
||||
element = {
|
||||
"required": True,
|
||||
"default": encrypt_value("test1234", pk=None),
|
||||
"variable": "x",
|
||||
"min": 0,
|
||||
"max": 8,
|
||||
"type": "password",
|
||||
}
|
||||
spec = survey_spec_factory([element])
|
||||
jt = JobTemplate(name="test-jt", survey_spec=spec, survey_enabled=True)
|
||||
assert not len(jt.survey_variable_validation({'x': '$encrypted$'}))
|
||||
|
||||
|
||||
@pytest.mark.survey
|
||||
class TestWorkflowSurveys:
|
||||
def test_update_kwargs_survey_defaults(self, survey_spec_factory):
|
||||
|
||||
Reference in New Issue
Block a user