mirror of
https://github.com/ansible/awx.git
synced 2026-07-29 08:59:55 -02:30
Api issue float (#11757)
* Fix integer/float errors in survey * Add SURVEY_TYPE_MAPPING to constants Add SURVEY_TYPE_MAPPING to constants, and replace usage in a couple of files. Co-authored-by: Alexander Komarov <akomarov.me@gmail.com>
This commit is contained in:
@@ -59,6 +59,38 @@ class SurveyVariableValidation:
|
||||
assert accepted == {}
|
||||
assert str(errors[0]) == "Value 5 for 'a' expected to be a string."
|
||||
|
||||
def test_job_template_survey_default_variable_validation(self, 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": "2",
|
||||
"max": 1024,
|
||||
"question_description": "",
|
||||
"choices": "",
|
||||
"variable": "a",
|
||||
"question_name": "float_number",
|
||||
"type": "float",
|
||||
}
|
||||
],
|
||||
"name": "",
|
||||
}
|
||||
|
||||
obj.survey_enabled = True
|
||||
accepted, _, errors = obj.accept_or_ignore_variables({"a": 2})
|
||||
assert accepted == {{"a": 2.0}}
|
||||
assert not errors
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job(mocker):
|
||||
|
||||
Reference in New Issue
Block a user