mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-03 07:41:30 -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
|
@ -23,10 +23,8 @@ from __future__ import (absolute_import, division, print_function)
|
|||
from nose.plugins.skip import SkipTest
|
||||
import pytest
|
||||
import sys
|
||||
import json
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.module_utils import basic
|
||||
from ansible.module_utils.ec2 import HAS_BOTO3
|
||||
from units.modules.utils import set_module_args
|
||||
|
||||
if not HAS_BOTO3:
|
||||
raise SkipTest("test_api_gateway.py requires the `boto3` and `botocore` modules")
|
||||
|
@ -34,11 +32,6 @@ if not HAS_BOTO3:
|
|||
import ansible.modules.cloud.amazon.aws_api_gateway as agw
|
||||
|
||||
|
||||
def set_module_args(args):
|
||||
args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
|
||||
basic._ANSIBLE_ARGS = to_bytes(args)
|
||||
|
||||
|
||||
exit_return_dict = {}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue