mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
block job template launches when an inventory is being deleted
see: #4382
This commit is contained in:
@@ -472,6 +472,23 @@ def test_scan_jt_surveys(inventory):
|
||||
assert "survey_enabled" in serializer.errors
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_launch_with_pending_deletion_inventory(get, post, organization_factory,
|
||||
job_template_factory, machine_credential,
|
||||
credential, net_credential):
|
||||
objs = organization_factory("org", superusers=['admin'])
|
||||
jt = job_template_factory("jt", organization=objs.organization, credential='c',
|
||||
inventory='test_inv', project='test_proj').job_template
|
||||
jt.inventory.pending_deletion = True
|
||||
jt.inventory.save()
|
||||
|
||||
resp = post(
|
||||
reverse('api:job_template_launch', kwargs={'pk': jt.pk}),
|
||||
objs.superusers.admin, expect=400
|
||||
)
|
||||
assert resp.data['inventory'] == ['The inventory associated with this Job Template is being deleted.']
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_launch_with_extra_credentials(get, post, organization_factory,
|
||||
job_template_factory, machine_credential,
|
||||
|
||||
Reference in New Issue
Block a user