mirror of
https://github.com/ansible/awx.git
synced 2026-05-21 15:57:52 -02:30
Fix awx-collection tests for ansible-core 2.21.0 (#16455)
Fix awx-collection tests for ansible-core 2.21.0 compat ansible-core 2.21.0 introduced _PARSED_MODULE_ARGS in module_utils/basic.py, used by _return_formatted() to conditionally include invocation data. The awx_collection test harness bypasses normal arg parsing via _load_params mock, leaving this variable as None and causing AttributeError on every exit_json/fail_json call. Mock _PARSED_MODULE_ARGS with _ansible_inject_invocation=True to match the pre-2.21 behavior of always including invocation data.
This commit is contained in:
@@ -236,6 +236,7 @@ def run_module(request, collection_import, mocker):
|
||||
|
||||
with mock.patch.object(resource_class, '_load_params', new=mock_load_params):
|
||||
mocker.patch('ansible.module_utils.basic._ANSIBLE_PROFILE', 'legacy')
|
||||
mocker.patch('ansible.module_utils.basic._PARSED_MODULE_ARGS', {'_ansible_inject_invocation': True}, create=True)
|
||||
|
||||
with mock.patch('ansible.module_utils.urls.Request.open', new=new_open):
|
||||
with _get_tower_cli_mgr(new_request):
|
||||
|
||||
Reference in New Issue
Block a user