mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 22:07:36 -02:30
selectively show POST in options for inventory sublists
This commit is contained in:
@@ -2,13 +2,21 @@ import pytest
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
@pytest.fixture
|
||||
def test_inventory_group_add(inventory, alice, bob, options):
|
||||
inventory.admin_role.add(alice)
|
||||
response = options(reverse('api:inventory_detail', args=[inventory.pk]), alice)
|
||||
print ' resp: ' + str(response.data)
|
||||
assert 'POST' in response.data
|
||||
@pytest.mark.django_db
|
||||
def test_inventory_group_host_can_add(inventory, alice, options):
|
||||
inventory.admin_role.members.add(alice)
|
||||
|
||||
inventory.read_role.add(bob)
|
||||
|
||||
|
||||
response = options(reverse('api:inventory_hosts_list', args=[inventory.pk]), alice)
|
||||
assert 'POST' in response.data['actions']
|
||||
response = options(reverse('api:inventory_groups_list', args=[inventory.pk]), alice)
|
||||
assert 'POST' in response.data['actions']
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_inventory_group_host_can_not_add(inventory, bob, options):
|
||||
inventory.read_role.members.add(bob)
|
||||
|
||||
response = options(reverse('api:inventory_hosts_list', args=[inventory.pk]), bob)
|
||||
assert 'POST' not in response.data['actions']
|
||||
response = options(reverse('api:inventory_groups_list', args=[inventory.pk]), bob)
|
||||
assert 'POST' not in response.data['actions']
|
||||
|
||||
Reference in New Issue
Block a user