1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

assert Credential unique_togehter works

This commit is contained in:
Wayne Witzel III 2016-06-21 11:36:31 -04:00
parent 14d67d560e
commit bc457ccef6

View File

@ -0,0 +1,15 @@
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):
objects = organization_factory("test")
cred = Credential(name="test", kind="net", organization=objects.organization)
cred.save()
with pytest.raises(IntegrityError):
cred = Credential(name="test", kind="net", organization=objects.organization)
cred.save()