mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
include related Jobs in group del protection
This commit is contained in:
@@ -12,6 +12,7 @@ from awx.main.models import (
|
||||
Inventory,
|
||||
InventorySource,
|
||||
InventoryUpdate,
|
||||
Job
|
||||
)
|
||||
from awx.main.utils.filters import SmartFilter
|
||||
|
||||
@@ -99,6 +100,29 @@ class TestSCMUpdateFeatures:
|
||||
assert not mck_update.called
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
class TestRelatedJobs:
|
||||
|
||||
def test_inventory_related(self, inventory):
|
||||
job = Job.objects.create(
|
||||
inventory=inventory
|
||||
)
|
||||
assert job.id in [jerb.id for jerb in inventory._get_related_jobs()]
|
||||
|
||||
def test_related_group_jobs(self, group):
|
||||
job = Job.objects.create(
|
||||
inventory=group.inventory
|
||||
)
|
||||
assert job.id in [jerb.id for jerb in group._get_related_jobs()]
|
||||
|
||||
def test_related_group_update(self, group):
|
||||
src = group.inventory_sources.create(name='foo')
|
||||
job = InventoryUpdate.objects.create(
|
||||
inventory_source=src
|
||||
)
|
||||
assert job.id in [jerb.id for jerb in group._get_related_jobs()]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
class TestSCMClean:
|
||||
def test_clean_update_on_project_update_multiple(self, inventory):
|
||||
|
||||
Reference in New Issue
Block a user