mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
remove conditional inventory sources POST
* Move logic from validator down to model * Allow only 1 inventory source of type scm with update_on_project_update set to True; for each inventory
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import pytest
|
||||
import mock
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
# AWX
|
||||
from awx.main.models import (
|
||||
Host,
|
||||
@@ -47,6 +49,23 @@ class TestSCMUpdateFeatures:
|
||||
assert not mck_update.called
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
class TestSCMClean:
|
||||
def test_clean_update_on_project_update_multiple(self, inventory):
|
||||
inv_src1 = InventorySource(inventory=inventory,
|
||||
update_on_project_update=True,
|
||||
source='scm')
|
||||
inv_src1.clean_update_on_project_update()
|
||||
inv_src1.save()
|
||||
|
||||
inv_src2 = InventorySource(inventory=inventory,
|
||||
update_on_project_update=True,
|
||||
source='scm')
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
inv_src2.clean_update_on_project_update()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def setup_ec2_gce(organization):
|
||||
ec2_inv = Inventory.objects.create(name='test_ec2', organization=organization)
|
||||
|
||||
Reference in New Issue
Block a user