mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 14:05:59 -03:30
Patches from tinkering with tests and default to devel version (#8)
This causes make install_collection to avoid templating the version so that it can still be used as-is in development
This commit is contained in:
@@ -108,7 +108,7 @@ def run_module(request, collection_import):
|
||||
sanitize_dict(py_data)
|
||||
resp._content = bytes(json.dumps(django_response.data), encoding='utf8')
|
||||
resp.status_code = django_response.status_code
|
||||
resp.headers = {'X-API-Product-Name': 'AWX', 'X-API-Product-Version': '11.0.0'}
|
||||
resp.headers = {'X-API-Product-Name': 'AWX', 'X-API-Product-Version': 'devel'}
|
||||
|
||||
if request.config.getoption('verbose') > 0:
|
||||
logger.info(
|
||||
|
||||
@@ -4,7 +4,6 @@ __metaclass__ = type
|
||||
import pytest
|
||||
|
||||
from awx.main.models import ActivityStream, JobTemplate, Job, NotificationTemplate
|
||||
from unittest import mock
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -162,9 +161,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
|
||||
|
||||
silence_warning.assert_has_calls(
|
||||
[mock.call("The field survey_spec of job_template {0} has encrypted data and "
|
||||
"may inaccurately report task is changed.".format(result['id']))])
|
||||
silence_warning.assert_called_once_with(
|
||||
"The field survey_spec of job_template {0} has encrypted data and "
|
||||
"may inaccurately report task is changed.".format(result['id']))
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
@@ -91,3 +91,21 @@ def test_duplicate_config(collection_import, silence_warning):
|
||||
'tower_config_file. Precedence may be unstable, '
|
||||
'we suggest either using config file or params.'
|
||||
)
|
||||
|
||||
|
||||
def test_no_templated_values(collection_import):
|
||||
"""This test corresponds to replacements done by
|
||||
awx_collection/tools/roles/template_galaxy/tasks/main.yml
|
||||
Those replacements should happen at build time, so they should not be
|
||||
checked into source.
|
||||
"""
|
||||
TowerModule = collection_import('plugins.module_utils.tower_api').TowerModule
|
||||
assert TowerModule._COLLECTION_VERSION == "devel", (
|
||||
'The collection version is templated when the collection is built '
|
||||
'and the code should retain the placeholder of "devel".'
|
||||
)
|
||||
InventoryModule = collection_import('plugins.inventory.tower').InventoryModule
|
||||
assert InventoryModule.NAME == 'awx.awx.tower', (
|
||||
'The inventory plugin FQCN is templated when the collection is built '
|
||||
'and the code should retain the default of awx.awx.'
|
||||
)
|
||||
|
||||
@@ -3,8 +3,6 @@ __metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from awx.main.models import Project
|
||||
|
||||
|
||||
@@ -18,9 +16,9 @@ def test_create_project(run_module, admin_user, organization, silence_warning):
|
||||
wait=False,
|
||||
scm_update_cache_timeout=5
|
||||
), admin_user)
|
||||
silence_warning.assert_has_calls(
|
||||
[mock.call('scm_update_cache_timeout will be ignored since scm_update_on_launch '
|
||||
'was not set to true')])
|
||||
silence_warning.assert_called_once_with(
|
||||
'scm_update_cache_timeout will be ignored since scm_update_on_launch '
|
||||
'was not set to true')
|
||||
|
||||
assert result.pop('changed', None), result
|
||||
|
||||
|
||||
@@ -41,6 +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
|
||||
|
||||
silence_warning.assert_has_calls(
|
||||
[mock.call("The field password of user {0} has encrypted data and "
|
||||
"may inaccurately report task is changed.".format(result['id']))])
|
||||
silence_warning.assert_called_once_with(
|
||||
"The field password of user {0} has encrypted data and "
|
||||
"may inaccurately report task is changed.".format(result['id']))
|
||||
|
||||
Reference in New Issue
Block a user