mirror of
https://github.com/ansible/awx.git
synced 2026-04-08 03:29:21 -02:30
handle credential.inputs in decryption utils
This commit is contained in:
@@ -1656,6 +1656,7 @@ class TestJobCredentials(TestJobExecution):
|
||||
'password': 'secret'
|
||||
}
|
||||
)
|
||||
azure_rm_credential.inputs['secret'] = ''
|
||||
azure_rm_credential.inputs['secret'] = encrypt_field(azure_rm_credential, 'secret')
|
||||
self.instance.credentials.add(azure_rm_credential)
|
||||
|
||||
@@ -2089,6 +2090,7 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
||||
'host': 'https://keystone.example.org'
|
||||
}
|
||||
)
|
||||
cred.inputs['ssh_key_data'] = ''
|
||||
cred.inputs['ssh_key_data'] = encrypt_field(
|
||||
cred, 'ssh_key_data'
|
||||
)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
# Copyright (c) 2017 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
import pytest
|
||||
|
||||
from awx.conf.models import Setting
|
||||
from awx.main.utils import encryption
|
||||
|
||||
@@ -45,6 +47,16 @@ def test_encrypt_field_with_empty_value():
|
||||
assert encrypted is None
|
||||
|
||||
|
||||
def test_encrypt_field_with_undefined_attr_raises_expected_exception():
|
||||
with pytest.raises(AttributeError):
|
||||
encryption.encrypt_field({}, 'undefined_attr')
|
||||
|
||||
|
||||
def test_decrypt_field_with_undefined_attr_raises_expected_exception():
|
||||
with pytest.raises(AttributeError):
|
||||
encryption.decrypt_field({}, 'undefined_attr')
|
||||
|
||||
|
||||
class TestSurveyReversibilityValue:
|
||||
'''
|
||||
Tests to enforce the contract with survey password question encrypted values
|
||||
|
||||
Reference in New Issue
Block a user