mirror of
https://github.com/ansible/awx.git
synced 2026-06-22 07:07:47 -02:30
Move some more tests out of root functional folder (#15753)
This commit is contained in:
16
awx/main/tests/functional/models/test_db_credential.py
Normal file
16
awx/main/tests/functional/models/test_db_credential.py
Normal file
@@ -0,0 +1,16 @@
|
||||
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()
|
||||
19
awx/main/tests/functional/models/test_ha.py
Normal file
19
awx/main/tests/functional/models/test_ha.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
|
||||
# AWX
|
||||
from awx.main.ha import is_ha_environment
|
||||
from awx.main.models.ha import Instance
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_multiple_instances():
|
||||
for i in range(2):
|
||||
Instance.objects.create(hostname=f'foo{i}', node_type='hybrid')
|
||||
assert is_ha_environment()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_db_localhost():
|
||||
Instance.objects.create(hostname='foo', node_type='hybrid')
|
||||
Instance.objects.create(hostname='bar', node_type='execution')
|
||||
assert is_ha_environment() is False
|
||||
Reference in New Issue
Block a user