mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
mostly includes renaming non-syntax references to tower
This commit is contained in:
@@ -41,4 +41,4 @@ def test_ad_hoc_command_wait_failed(run_module, admin_user):
|
||||
def test_ad_hoc_command_wait_not_found(run_module, admin_user):
|
||||
result = run_module('ad_hoc_command_wait', dict(command_id=42), admin_user)
|
||||
result.pop('invocation', None)
|
||||
assert result == {"failed": True, "msg": "Unable to wait on ad hoc command 42; that ID does not exist in Tower."}
|
||||
assert result == {"failed": True, "msg": "Unable to wait on ad hoc command 42; that ID does not exist."}
|
||||
|
||||
@@ -14,7 +14,7 @@ import re
|
||||
|
||||
# Read-only endpoints are dynamically created by an options page with no POST section.
|
||||
# Normally a read-only endpoint should not have a module (i.e. /api/v2/me) but sometimes we reuse a name
|
||||
# For example, we have a tower_role module but /api/v2/roles is a read only endpoint.
|
||||
# For example, we have a role module but /api/v2/roles is a read only endpoint.
|
||||
# This list indicates which read-only endpoints have associated modules with them.
|
||||
read_only_endpoints_with_modules = ['settings', 'role', 'project_update']
|
||||
|
||||
@@ -61,11 +61,11 @@ no_api_parameter_ok = {
|
||||
'workflow_job_template_node': ['organization', 'approval_node'],
|
||||
# Survey is how we handle associations
|
||||
'workflow_job_template': ['survey_spec', 'destroy_current_schema'],
|
||||
# ad hoc commands support interval and timeout since its more like tower_job_launch
|
||||
# ad hoc commands support interval and timeout since its more like job_launch
|
||||
'ad_hoc_command': ['interval', 'timeout', 'wait'],
|
||||
# tower_group parameters to perserve hosts and children.
|
||||
# group parameters to perserve hosts and children.
|
||||
'group': ['preserve_existing_children', 'preserve_existing_hosts'],
|
||||
# tower_workflow_approval parameters that do not apply when approving an approval node.
|
||||
# workflow_approval parameters that do not apply when approving an approval node.
|
||||
'workflow_approval': ['action', 'interval', 'timeout', 'workflow_job_id'],
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ def test_children_alias_of_groups(run_module, admin_user, organization):
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_tower_group_idempotent(run_module, admin_user):
|
||||
def test_group_idempotent(run_module, admin_user):
|
||||
# https://github.com/ansible/ansible/issues/46803
|
||||
org = Organization.objects.create(name='test-org')
|
||||
inv = Inventory.objects.create(name='test-inv', organization=org)
|
||||
|
||||
@@ -34,4 +34,4 @@ def test_job_wait_failed(run_module, admin_user):
|
||||
def test_job_wait_not_found(run_module, admin_user):
|
||||
result = run_module('job_wait', dict(job_id=42), admin_user)
|
||||
result.pop('invocation', None)
|
||||
assert result == {"failed": True, "msg": "Unable to wait on job 42; that ID does not exist in Tower."}
|
||||
assert result == {"failed": True, "msg": "Unable to wait on job 42; that ID does not exist."}
|
||||
|
||||
@@ -10,7 +10,7 @@ from requests.models import Response
|
||||
from unittest import mock
|
||||
|
||||
awx_name = 'AWX'
|
||||
tower_name = 'Red Hat Automation Controller'
|
||||
tower_name = 'Red Hat Automation Platform Controller'
|
||||
ping_version = '1.2.3'
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ def status(self):
|
||||
return 200
|
||||
|
||||
|
||||
def mock_tower_ping_response(self, method, url, **kwargs):
|
||||
def mock_controller_ping_response(self, method, url, **kwargs):
|
||||
r = Response()
|
||||
r.getheader = getTowerheader.__get__(r)
|
||||
r.read = read.__get__(r)
|
||||
@@ -86,25 +86,25 @@ def test_version_warning_strictness_awx(collection_import, silence_warning):
|
||||
silence_warning.assert_not_called()
|
||||
|
||||
|
||||
def test_version_warning_strictness_tower(collection_import, silence_warning):
|
||||
def test_version_warning_strictness_controller(collection_import, silence_warning):
|
||||
ControllerAPIModule = collection_import('plugins.module_utils.controller_api').ControllerAPIModule
|
||||
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
|
||||
testargs = ['module_file2.py', json.dumps(cli_data)]
|
||||
# Compare 1.2.0 to 1.2.3 (major/minor matches)
|
||||
with mock.patch.object(sys, 'argv', testargs):
|
||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response):
|
||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_controller_ping_response):
|
||||
my_module = ControllerAPIModule(argument_spec=dict())
|
||||
my_module._COLLECTION_VERSION = "1.2.0"
|
||||
my_module._COLLECTION_TYPE = "tower"
|
||||
my_module._COLLECTION_TYPE = "controller"
|
||||
my_module.get_endpoint('ping')
|
||||
silence_warning.assert_not_called()
|
||||
|
||||
# Compare 1.0.0 to 1.2.3 (major/minor fail to match)
|
||||
with mock.patch.object(sys, 'argv', testargs):
|
||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_tower_ping_response):
|
||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_controller_ping_response):
|
||||
my_module = ControllerAPIModule(argument_spec=dict())
|
||||
my_module._COLLECTION_VERSION = "1.0.0"
|
||||
my_module._COLLECTION_TYPE = "tower"
|
||||
my_module._COLLECTION_TYPE = "controller"
|
||||
my_module.get_endpoint('ping')
|
||||
silence_warning.assert_called_once_with(
|
||||
'You are running collection version {0} but connecting to {1} version {2}'.format(my_module._COLLECTION_VERSION, tower_name, ping_version)
|
||||
@@ -119,7 +119,7 @@ def test_type_warning(collection_import, silence_warning):
|
||||
with mock.patch('ansible.module_utils.urls.Request.open', new=mock_awx_ping_response):
|
||||
my_module = ControllerAPIModule(argument_spec={})
|
||||
my_module._COLLECTION_VERSION = ping_version
|
||||
my_module._COLLECTION_TYPE = "tower"
|
||||
my_module._COLLECTION_TYPE = "controller"
|
||||
my_module.get_endpoint('ping')
|
||||
silence_warning.assert_called_once_with(
|
||||
'You are using the {0} version of this collection but connecting to {1}'.format(my_module._COLLECTION_TYPE, awx_name)
|
||||
@@ -157,7 +157,7 @@ def test_no_templated_values(collection_import):
|
||||
'The collection version is templated when the collection is built ' 'and the code should retain the placeholder of "0.0.1-devel".'
|
||||
)
|
||||
InventoryModule = collection_import('plugins.inventory.controller').InventoryModule
|
||||
assert InventoryModule.NAME == 'awx.awx.tower', (
|
||||
assert InventoryModule.NAME == 'awx.awx.controller', (
|
||||
'The inventory plugin FQCN is templated when the collection is built ' 'and the code should retain the default of awx.awx.'
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user