mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 05:55:59 -03:30
move circular group association validation to view
This commit is contained in:
15
awx/main/tests/functional/api/test_group.py
Normal file
15
awx/main/tests/functional/api/test_group.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
|
||||
from awx.api.versioning import reverse
|
||||
|
||||
from awx.main.models import Group
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_cyclical_association_prohibited(post, inventory, admin_user):
|
||||
parent = Group.objects.create(inventory=inventory, name='parent_group')
|
||||
child = parent.children.create(inventory=inventory, name='child_group')
|
||||
# Attempt to make parent a child of the child
|
||||
url = reverse('api:group_children_list', kwargs={'pk': child.id})
|
||||
response = post(url, dict(id=parent.id), admin_user, expect=400)
|
||||
assert 'cyclical' in response.data['error'].lower()
|
||||
Reference in New Issue
Block a user