1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

add required fields for network credentials

see: https://github.com/ansible/ansible-tower/issues/7466
This commit is contained in:
Ryan Petrello 2017-08-18 15:48:57 -04:00
parent 50782b9465
commit 90b5d98e5c
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
3 changed files with 4 additions and 2 deletions

View File

@ -735,7 +735,8 @@ def net(cls):
'dependencies': { 'dependencies': {
'ssh_key_unlock': ['ssh_key_data'], 'ssh_key_unlock': ['ssh_key_data'],
'authorize_password': ['authorize'], 'authorize_password': ['authorize'],
} },
'required': ['username'],
} }
) )

View File

@ -748,6 +748,7 @@ def test_falsey_field_data(get, post, organization, admin, field_value):
'credential_type': net.pk, 'credential_type': net.pk,
'organization': organization.id, 'organization': organization.id,
'inputs': { 'inputs': {
'username': 'joe-user', # username is required
'authorize': field_value 'authorize': field_value
} }
} }

View File

@ -226,7 +226,7 @@ def test_credential_creation_validation_failure(organization_factory, inputs):
[EXAMPLE_PRIVATE_KEY.replace('=', '\u003d'), None, True], # automatically fix JSON-encoded GCE keys [EXAMPLE_PRIVATE_KEY.replace('=', '\u003d'), None, True], # automatically fix JSON-encoded GCE keys
]) ])
def test_ssh_key_data_validation(organization, kind, ssh_key_data, ssh_key_unlock, valid): def test_ssh_key_data_validation(organization, kind, ssh_key_data, ssh_key_unlock, valid):
inputs = {} inputs = {'username': 'joe-user'}
if ssh_key_data: if ssh_key_data:
inputs['ssh_key_data'] = ssh_key_data inputs['ssh_key_data'] = ssh_key_data
if ssh_key_unlock: if ssh_key_unlock: