mirror of
https://github.com/ansible/awx.git
synced 2026-11-22 16:26:10 -03:30
make CustomInvetoryScript a resource.
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
import pytest
|
||||
|
||||
from awx.main.migrations import _rbac as rbac
|
||||
from awx.main.models import Permission, Host
|
||||
from awx.main.models import (
|
||||
Permission,
|
||||
Host,
|
||||
CustomInventoryScript,
|
||||
)
|
||||
from awx.main.access import InventoryAccess
|
||||
from django.apps import apps
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_custom_inv_script_access(organization, user):
|
||||
u = user('user', False)
|
||||
|
||||
custom_inv = CustomInventoryScript.objects.create(name='test', script='test', description='test')
|
||||
custom_inv.organization = organization
|
||||
assert not custom_inv.accessible_by(u, {'read':True})
|
||||
|
||||
organization.member_role.members.add(u)
|
||||
assert custom_inv.accessible_by(u, {'read':True})
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_inventory_admin_user(inventory, permissions, user):
|
||||
u = user('admin', False)
|
||||
|
||||
Reference in New Issue
Block a user