mirror of
https://github.com/ansible/awx.git
synced 2026-03-16 08:27:29 -02:30
Merge remote-tracking branch 'tower/test_stable-2.6' into merge_26_2
This commit is contained in:
@@ -19,8 +19,11 @@ from ansible.module_utils.six import raise_from
|
||||
|
||||
from ansible_base.rbac.models import RoleDefinition, DABPermission
|
||||
from ansible_base.rbac import permission_registry
|
||||
<<<<<<< HEAD
|
||||
|
||||
from awx.main.tests.conftest import load_all_credentials # noqa: F401; pylint: disable=unused-import
|
||||
=======
|
||||
>>>>>>> tower/test_stable-2.6
|
||||
from awx.main.tests.functional.conftest import _request
|
||||
from awx.main.tests.functional.conftest import credentialtype_scm, credentialtype_ssh # noqa: F401; pylint: disable=unused-import
|
||||
from awx.main.models import (
|
||||
|
||||
@@ -65,7 +65,7 @@ def test_export(run_module, admin_user):
|
||||
all_assets_except_users = {k: v for k, v in assets.items() if k != 'users'}
|
||||
|
||||
for k, v in all_assets_except_users.items():
|
||||
assert v == [], f"Expected resource {k} to be empty. Instead it is {v}"
|
||||
assert v == [] or v is None, f"Expected resource {k} to be empty. Instead it is {v}"
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
@@ -20,6 +20,10 @@ def test_create_organization(run_module, admin_user):
|
||||
'controller_username': None,
|
||||
'controller_password': None,
|
||||
'validate_certs': None,
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
'aap_token': None,
|
||||
>>>>>>> tower/test_stable-2.6
|
||||
'controller_config_file': None,
|
||||
}
|
||||
|
||||
@@ -52,6 +56,10 @@ def test_galaxy_credential_order(run_module, admin_user):
|
||||
'controller_username': None,
|
||||
'controller_password': None,
|
||||
'validate_certs': None,
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
'aap_token': None,
|
||||
>>>>>>> tower/test_stable-2.6
|
||||
'controller_config_file': None,
|
||||
'galaxy_credentials': cred_ids,
|
||||
}
|
||||
@@ -76,6 +84,10 @@ def test_galaxy_credential_order(run_module, admin_user):
|
||||
'controller_username': None,
|
||||
'controller_password': None,
|
||||
'validate_certs': None,
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
'aap_token': None,
|
||||
>>>>>>> tower/test_stable-2.6
|
||||
'controller_config_file': None,
|
||||
'galaxy_credentials': cred_ids,
|
||||
}
|
||||
|
||||
30
awx_collection/test/awx/test_token.py
Normal file
30
awx_collection/test/awx/test_token.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from awx.main.models import OAuth2AccessToken
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_token(run_module, admin_user):
|
||||
|
||||
module_args = {
|
||||
'description': 'barfoo',
|
||||
'state': 'present',
|
||||
'scope': 'read',
|
||||
'controller_host': None,
|
||||
'controller_username': None,
|
||||
'controller_password': None,
|
||||
'validate_certs': None,
|
||||
'aap_token': None,
|
||||
'controller_config_file': None,
|
||||
}
|
||||
|
||||
result = run_module('token', module_args, admin_user)
|
||||
assert result.get('changed'), result
|
||||
|
||||
tokens = OAuth2AccessToken.objects.filter(description='barfoo')
|
||||
assert len(tokens) == 1, 'Tokens with description of barfoo != 0: {0}'.format(len(tokens))
|
||||
assert tokens[0].scope == 'read', 'Token was not given read access'
|
||||
Reference in New Issue
Block a user