mirror of
https://github.com/ansible/awx.git
synced 2026-02-02 18:18:12 -03:30
Credentials now have a required CredentialType, which defines inputs (i.e., username, password) and injectors (i.e., assign the username to SOME_ENV_VARIABLE at job runtime) This commit only implements the model changes necessary to support the new inputs model, and includes code for the credential serializer that allows backwards-compatible support for /api/v1/credentials/; tasks.py still needs to be updated to actually respect CredentialType injectors. This change *will* break the UI for credentials (because it needs to be updated to use the new v2 endpoint). see: #5877 see: #5876 see: #5805
17 lines
531 B
Python
17 lines
531 B
Python
import pytest
|
|
|
|
from django.db import IntegrityError
|
|
from awx.main.models import Credential
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_cred_unique_org_name_kind(organization_factory, credentialtype_ssh):
|
|
objects = organization_factory("test")
|
|
|
|
cred = Credential(name="test", credential_type=credentialtype_ssh, organization=objects.organization)
|
|
cred.save()
|
|
|
|
with pytest.raises(IntegrityError):
|
|
cred = Credential(name="test", credential_type=credentialtype_ssh, organization=objects.organization)
|
|
cred.save()
|