pycharm refactor rename files and class, linux rename tower_ controller_

This commit is contained in:
Seth Foster
2021-04-28 18:13:22 -04:00
parent 2ad84b60b3
commit 44fed1d7c1
93 changed files with 234 additions and 149 deletions

View File

@@ -150,14 +150,14 @@ def run_module(request, collection_import):
def mock_load_params(self):
self.params = module_params
if getattr(resource_module, 'TowerAWXKitModule', None):
resource_class = resource_module.TowerAWXKitModule
elif getattr(resource_module, 'TowerAPIModule', None):
resource_class = resource_module.TowerAPIModule
if getattr(resource_module, 'ControllerAWXKitModule', None):
resource_class = resource_module.ControllerAWXKitModule
elif getattr(resource_module, 'ControllerAPIModule', None):
resource_class = resource_module.ControllerAPIModule
elif getattr(resource_module, 'TowerLegacyModule', None):
resource_class = resource_module.TowerLegacyModule
else:
raise ("The module has neither a TowerLegacyModule, TowerAWXKitModule or a TowerAPIModule")
raise ("The module has neither a TowerLegacyModule, ControllerAWXKitModule or a ControllerAPIModule")
with mock.patch.object(resource_class, '_load_params', new=mock_load_params):
# Call the test utility (like a mock server) instead of issuing HTTP requests

View File

@@ -49,7 +49,7 @@ def mock_awx_ping_response(self, method, url, **kwargs):
def test_version_warning(collection_import, silence_warning):
TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule
TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
testargs = ['module_file2.py', json.dumps(cli_data)]
with mock.patch.object(sys, 'argv', testargs):
@@ -64,7 +64,7 @@ def test_version_warning(collection_import, silence_warning):
def test_version_warning_strictness_awx(collection_import, silence_warning):
TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule
TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
testargs = ['module_file2.py', json.dumps(cli_data)]
# Compare 1.0.0 to 1.2.3 (major matches)
@@ -87,7 +87,7 @@ def test_version_warning_strictness_awx(collection_import, silence_warning):
def test_version_warning_strictness_tower(collection_import, silence_warning):
TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule
TowerAPIModule = collection_import('plugins.module_utils.tower_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)
@@ -112,7 +112,7 @@ def test_version_warning_strictness_tower(collection_import, silence_warning):
def test_type_warning(collection_import, silence_warning):
TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule
TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule
cli_data = {'ANSIBLE_MODULE_ARGS': {}}
testargs = ['module_file2.py', json.dumps(cli_data)]
with mock.patch.object(sys, 'argv', testargs):
@@ -128,7 +128,7 @@ def test_type_warning(collection_import, silence_warning):
def test_duplicate_config(collection_import, silence_warning):
# imports done here because of PATH issues unique to this test suite
TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule
TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule
data = {'name': 'zigzoom', 'zig': 'zoom', 'tower_username': 'bob', 'tower_config_file': 'my_config'}
with mock.patch.object(TowerAPIModule, 'load_config') as mock_load:
@@ -152,7 +152,7 @@ def test_no_templated_values(collection_import):
Those replacements should happen at build time, so they should not be
checked into source.
"""
TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule
TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule
assert TowerAPIModule._COLLECTION_VERSION == "0.0.1-devel", (
'The collection version is templated when the collection is built ' 'and the code should retain the placeholder of "0.0.1-devel".'
)