mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-01 06:41: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
|
@ -19,13 +19,12 @@
|
|||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
import copy
|
||||
|
||||
from nose.plugins.skip import SkipTest
|
||||
from ansible.module_utils.aws.core import HAS_BOTO3
|
||||
from ansible.module_utils import basic
|
||||
from ansible.module_utils.basic import to_bytes
|
||||
from ansible.compat.tests.mock import MagicMock
|
||||
import json
|
||||
import copy
|
||||
from units.modules.utils import set_module_args
|
||||
|
||||
if not HAS_BOTO3:
|
||||
raise SkipTest("test_api_gateway.py requires the `boto3` and `botocore` modules")
|
||||
|
@ -45,11 +44,6 @@ base_module_args = {
|
|||
}
|
||||
|
||||
|
||||
def set_module_args(mod_args):
|
||||
args = json.dumps({'ANSIBLE_MODULE_ARGS': mod_args})
|
||||
basic._ANSIBLE_ARGS = to_bytes(args)
|
||||
|
||||
|
||||
def test_module_is_created_sensibly():
|
||||
set_module_args(base_module_args)
|
||||
module = setup_module_object()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue