mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 19:37:38 -02:30
Add field numbering specification in module_util file, update unit tests
This commit is contained in:
@@ -33,7 +33,7 @@ class ItemNotDefined(Exception):
|
|||||||
|
|
||||||
class TowerModule(AnsibleModule):
|
class TowerModule(AnsibleModule):
|
||||||
# This gets set by the make process so whatever is in here is irrelevant
|
# This gets set by the make process so whatever is in here is irrelevant
|
||||||
_COLLECTION_VERSION = "11.1.0"
|
_COLLECTION_VERSION = "11.0.0"
|
||||||
_COLLECTION_TYPE = "awx"
|
_COLLECTION_TYPE = "awx"
|
||||||
# This maps the collections type (awx/tower) to the values returned by the API
|
# This maps the collections type (awx/tower) to the values returned by the API
|
||||||
# Those values can be found in awx/api/generics.py line 204
|
# Those values can be found in awx/api/generics.py line 204
|
||||||
@@ -339,7 +339,7 @@ class TowerModule(AnsibleModule):
|
|||||||
data = dumps(kwargs.get('data', {}))
|
data = dumps(kwargs.get('data', {}))
|
||||||
|
|
||||||
with open('/tmp/john', 'w') as f:
|
with open('/tmp/john', 'w') as f:
|
||||||
f.write("{}".format(self.url.geturl()))
|
f.write("{0}".format(self.url.geturl()))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = self.session.open(method, self.url.geturl(), headers=headers, validate_certs=self.verify_ssl, follow_redirects=True, data=data)
|
response = self.session.open(method, self.url.geturl(), headers=headers, validate_certs=self.verify_ssl, follow_redirects=True, data=data)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ __metaclass__ = type
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from awx.main.models import ActivityStream, JobTemplate, Job, NotificationTemplate
|
from awx.main.models import ActivityStream, JobTemplate, Job, NotificationTemplate
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
@@ -161,10 +162,9 @@ def test_job_template_with_survey_encrypted_default(run_module, admin_user, proj
|
|||||||
|
|
||||||
assert result.get('changed', False), result # not actually desired, but assert for sanity
|
assert result.get('changed', False), result # not actually desired, but assert for sanity
|
||||||
|
|
||||||
silence_warning.assert_called_once_with(
|
silence_warning.assert_has_calls(
|
||||||
"The field survey_spec of job_template {0} has encrypted data and "
|
[mock.call("The field survey_spec of job_template {0} has encrypted data and "
|
||||||
"may inaccurately report task is changed.".format(result['id'])
|
"may inaccurately report task is changed.".format(result['id']))])
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ def test_create_project(run_module, admin_user, organization):
|
|||||||
wait=False,
|
wait=False,
|
||||||
scm_update_cache_timeout=5
|
scm_update_cache_timeout=5
|
||||||
), admin_user)
|
), admin_user)
|
||||||
mock_warn.assert_called_once_with('scm_update_cache_timeout will be ignored since scm_update_on_launch was not set to true')
|
mock_warn.assert_has_calls(
|
||||||
|
[mock.call('scm_update_cache_timeout will be ignored since scm_update_on_launch '
|
||||||
|
'was not set to true')])
|
||||||
|
|
||||||
assert result.pop('changed', None), result
|
assert result.pop('changed', None), result
|
||||||
|
|
||||||
proj = Project.objects.get(name='foo')
|
proj = Project.objects.get(name='foo')
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ def test_password_no_op_warning(run_module, admin_user, mock_auth_stuff, silence
|
|||||||
|
|
||||||
assert result.get('changed') # not actually desired, but assert for sanity
|
assert result.get('changed') # not actually desired, but assert for sanity
|
||||||
|
|
||||||
silence_warning.assert_called_once_with(
|
silence_warning.assert_has_calls(
|
||||||
"The field password of user {0} has encrypted data and "
|
[mock.call("The field password of user {0} has encrypted data and "
|
||||||
"may inaccurately report task is changed.".format(result['id'])
|
"may inaccurately report task is changed.".format(result['id']))])
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user