mirror of
https://github.com/ansible/awx.git
synced 2026-06-29 10:28:01 -02:30
properly sanitize encrypted default passwords in JT.survey_spec
see: https://github.com/ansible/ansible-tower/issues/7259
This commit is contained in:
committed by
Matthew Jones
parent
f2d46baf09
commit
82d05e0a10
@@ -7,7 +7,6 @@ from collections import namedtuple
|
||||
from awx.api.views import (
|
||||
ApiVersionRootView,
|
||||
JobTemplateLabelList,
|
||||
JobTemplateSurveySpec,
|
||||
InventoryInventorySourcesUpdate,
|
||||
InventoryHostsList,
|
||||
HostInsights,
|
||||
@@ -80,19 +79,6 @@ class TestJobTemplateLabelList:
|
||||
assert mixin_unattach.called_with(mock_request, None, None)
|
||||
|
||||
|
||||
class TestJobTemplateSurveySpec(object):
|
||||
@mock.patch('awx.api.views.feature_enabled', lambda feature: True)
|
||||
def test_get_password_type(self, mocker, mock_response_new):
|
||||
JobTemplate = namedtuple('JobTemplate', 'survey_spec')
|
||||
obj = JobTemplate(survey_spec={'spec':[{'type': 'password', 'default': 'my_default'}]})
|
||||
with mocker.patch.object(JobTemplateSurveySpec, 'get_object', return_value=obj):
|
||||
view = JobTemplateSurveySpec()
|
||||
response = view.get(mocker.MagicMock())
|
||||
assert response == mock_response_new
|
||||
# which there was a better way to do this!
|
||||
assert response.call_args[0][1]['spec'][0]['default'] == '$encrypted$'
|
||||
|
||||
|
||||
class TestInventoryInventorySourcesUpdate:
|
||||
|
||||
@pytest.mark.parametrize("can_update, can_access, is_source, is_up_on_proj, expected", [
|
||||
|
||||
Reference in New Issue
Block a user