mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 10:41:05 -03:30
Release unified UJT unique_together constraint.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import pytest
|
||||
import mock
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
from awx.api.versioning import reverse
|
||||
|
||||
from awx.main.models import InventorySource, Project, ProjectUpdate
|
||||
@@ -34,6 +36,19 @@ def test_inventory_source_notification_on_cloud_only(get, post, inventory_source
|
||||
assert response.status_code == 400
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_inventory_source_unique_together_with_inv(inventory_factory):
|
||||
inv1 = inventory_factory('foo')
|
||||
inv2 = inventory_factory('bar')
|
||||
is1 = InventorySource(name='foo', source='file', inventory=inv1)
|
||||
is1.save()
|
||||
is2 = InventorySource(name='foo', source='file', inventory=inv1)
|
||||
with pytest.raises(ValidationError):
|
||||
is2.validate_unique()
|
||||
is2 = InventorySource(name='foo', source='file', inventory=inv2)
|
||||
is2.validate_unique()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("role_field,expected_status_code", [
|
||||
(None, 403),
|
||||
('admin_role', 200),
|
||||
@@ -347,4 +362,3 @@ class TestInsightsCredential:
|
||||
patch(insights_inventory.get_absolute_url(),
|
||||
{'insights_credential': scm_credential.id}, admin_user,
|
||||
expect=400)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user