mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 03:17:39 -02:30
fix adhoc IG bug and prevent related inventory deletion
This commit is contained in:
@@ -3,7 +3,8 @@ import pytest
|
||||
from awx.main.models import (
|
||||
Host,
|
||||
CustomInventoryScript,
|
||||
Schedule
|
||||
Schedule,
|
||||
AdHocCommand
|
||||
)
|
||||
from awx.main.access import (
|
||||
InventoryAccess,
|
||||
@@ -11,10 +12,19 @@ from awx.main.access import (
|
||||
HostAccess,
|
||||
InventoryUpdateAccess,
|
||||
CustomInventoryScriptAccess,
|
||||
ScheduleAccess
|
||||
ScheduleAccess,
|
||||
StateConflict
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_running_job_protection(inventory, admin_user):
|
||||
AdHocCommand.objects.create(inventory=inventory, status='running')
|
||||
access = InventoryAccess(admin_user)
|
||||
with pytest.raises(StateConflict):
|
||||
access.can_delete(inventory)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_custom_inv_script_access(organization, user):
|
||||
u = user('user', False)
|
||||
|
||||
Reference in New Issue
Block a user