mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 06:01:25 -03:30
test creating credential for self & org_member
This commit is contained in:
parent
253606c8bf
commit
f692f0c70a
@ -1,5 +1,7 @@
|
||||
import pytest
|
||||
|
||||
import mock
|
||||
|
||||
from awx.main.access import CredentialAccess
|
||||
from awx.main.models.credential import Credential
|
||||
from django.contrib.auth.models import User
|
||||
@ -22,6 +24,21 @@ def test_credential_access_superuser():
|
||||
assert access.can_delete(credential)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_credential_access_self(rando):
|
||||
access = CredentialAccess(rando)
|
||||
assert access.can_add({'user': rando.pk})
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize('ext_auth', [True, False])
|
||||
def test_credential_access_org_user(org_member, org_admin, ext_auth):
|
||||
access = CredentialAccess(org_admin)
|
||||
with mock.patch('awx.main.access.settings') as settings_mock:
|
||||
settings_mock.MANAGE_ORGANIZATION_AUTH = ext_auth
|
||||
assert access.can_add({'user': org_member.pk})
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_credential_access_auditor(credential, organization_factory):
|
||||
objects = organization_factory("org_cred_auditor",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user