mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
Unit tests: share common code (#31456)
* move set_module_args to units.modules.utils * unit tests: reuse set_module_args * unit tests: mock exit/fail_json in module.utils.ModuleTestCase * unit tests: use module.utils.ModuleTestCase * unit tests: fix 'import shadowed by loop variable'
This commit is contained in:
parent
71a6dcdf3e
commit
a5c9726502
154 changed files with 671 additions and 1113 deletions
|
@ -20,12 +20,11 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
import copy
|
||||
import json
|
||||
import pytest
|
||||
|
||||
from ansible.compat.tests.mock import MagicMock, Mock, patch
|
||||
from ansible.module_utils import basic
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from units.modules.utils import set_module_args
|
||||
|
||||
|
||||
boto3 = pytest.importorskip("boto3")
|
||||
|
@ -35,11 +34,6 @@ _temp = __import__("ansible.modules.cloud.amazon.lambda")
|
|||
lda = getattr(_temp.modules.cloud.amazon, "lambda")
|
||||
|
||||
|
||||
def set_module_args(args):
|
||||
args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
|
||||
basic._ANSIBLE_ARGS = to_bytes(args)
|
||||
|
||||
|
||||
base_lambda_config = {
|
||||
'FunctionName': 'lambda_name',
|
||||
'Role': 'arn:aws:iam::987654321012:role/lambda_basic_execution',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue