mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
add api for managing credential input sources
This commit is contained in:
@@ -250,6 +250,33 @@ def credentialtype_insights():
|
||||
return insights_type
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def credentialtype_external():
|
||||
external_type_inputs = {
|
||||
'fields': [{
|
||||
'id': 'url',
|
||||
'label': 'Server URL',
|
||||
'type': 'string',
|
||||
'help_text': 'The server url.'
|
||||
}, {
|
||||
'id': 'token',
|
||||
'label': 'Token',
|
||||
'type': 'string',
|
||||
'secret': True,
|
||||
'help_text': 'An access token for the server.'
|
||||
}],
|
||||
'required': ['url', 'token'],
|
||||
}
|
||||
external_type = CredentialType(
|
||||
kind='external',
|
||||
managed_by_tower=True,
|
||||
name='External Service',
|
||||
inputs=external_type_inputs
|
||||
)
|
||||
external_type.save()
|
||||
return external_type
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def credential(credentialtype_aws):
|
||||
return Credential.objects.create(credential_type=credentialtype_aws, name='test-cred',
|
||||
@@ -293,6 +320,18 @@ def org_credential(organization, credentialtype_aws):
|
||||
organization=organization)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def external_credential(credentialtype_external):
|
||||
return Credential.objects.create(credential_type=credentialtype_external, name='external-cred',
|
||||
inputs={'url': 'http://testhost.com', 'token': 'secret1'})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def other_external_credential(credentialtype_external):
|
||||
return Credential.objects.create(credential_type=credentialtype_external, name='other-external-cred',
|
||||
inputs={'url': 'http://testhost.com', 'token': 'secret2'})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def inventory(organization):
|
||||
return organization.inventories.create(name="test-inv")
|
||||
|
||||
Reference in New Issue
Block a user