mirror of
https://github.com/ansible/awx.git
synced 2026-02-17 11:10:03 -03:30
* Update collection args (#16025) * update collection arguments * Add integration testing for new param * fix: sanity check failures --------- Co-authored-by: Sean Sullivan <ssulliva@redhat.com> Co-authored-by: Alan Rominger <arominge@redhat.com> * update formatting for sanity testing * fixing indentation for sanity suite * adjust tests to use new token name * update tests to use aap_token instead of controller_oauthtoken * add back aliases for backward compat * we have integration tests that still leverage the old token name * while we can rename these, this tells me that customers might still have them in the wild and breaking them in a z stream is no bueno * revert alias changes --------- Co-authored-by: Peter Braun <pbraun@redhat.com> Co-authored-by: Sean Sullivan <ssulliva@redhat.com> Co-authored-by: Alan Rominger <arominge@redhat.com>
31 lines
876 B
Python
31 lines
876 B
Python
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'
|