Adds fixes to various bigip tests (#33471)

upstream changes broke downstream code. this rectifies that
pull/33472/head
Tim Rupp 7 years ago committed by GitHub
parent f6be12b5d8
commit 929a1df91d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,21 +15,23 @@ if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7") raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock from ansible.compat.tests.mock import Mock
from ansible.compat.tests.mock import patch
from ansible.module_utils.f5_utils import AnsibleF5Client from ansible.module_utils.f5_utils import AnsibleF5Client
from units.modules.utils import set_module_args
try: try:
from library.bigip_configsync_actions import Parameters from library.bigip_configsync_actions import Parameters
from library.bigip_configsync_actions import ModuleManager from library.bigip_configsync_actions import ModuleManager
from library.bigip_configsync_actions import ArgumentSpec from library.bigip_configsync_actions import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
except ImportError: except ImportError:
try: try:
from ansible.modules.network.f5.bigip_configsync_actions import Parameters from ansible.modules.network.f5.bigip_configsync_actions import Parameters
from ansible.modules.network.f5.bigip_configsync_actions import ModuleManager from ansible.modules.network.f5.bigip_configsync_actions import ModuleManager
from ansible.modules.network.f5.bigip_configsync_actions import ArgumentSpec from ansible.modules.network.f5.bigip_configsync_actions import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from units.modules.utils import set_module_args
except ImportError: except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library") raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

@ -16,9 +16,8 @@ if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7") raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock from ansible.compat.tests.mock import Mock
from ansible.module_utils import basic from ansible.compat.tests.mock import patch
from ansible.module_utils._text import to_bytes
from ansible.module_utils.f5_utils import AnsibleF5Client from ansible.module_utils.f5_utils import AnsibleF5Client
from ansible.module_utils.f5_utils import F5ModuleError from ansible.module_utils.f5_utils import F5ModuleError
@ -27,12 +26,14 @@ try:
from library.bigip_device_connectivity import ModuleManager from library.bigip_device_connectivity import ModuleManager
from library.bigip_device_connectivity import ArgumentSpec from library.bigip_device_connectivity import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
except ImportError: except ImportError:
try: try:
from ansible.modules.network.f5.bigip_device_connectivity import Parameters from ansible.modules.network.f5.bigip_device_connectivity import Parameters
from ansible.modules.network.f5.bigip_device_connectivity import ModuleManager from ansible.modules.network.f5.bigip_device_connectivity import ModuleManager
from ansible.modules.network.f5.bigip_device_connectivity import ArgumentSpec from ansible.modules.network.f5.bigip_device_connectivity import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from units.modules.utils import set_module_args
except ImportError: except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library") raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
@ -40,19 +41,21 @@ fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {} fixture_data = {}
def set_module_args(args):
args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
basic._ANSIBLE_ARGS = to_bytes(args)
def load_fixture(name): def load_fixture(name):
path = os.path.join(fixture_path, name) path = os.path.join(fixture_path, name)
if path in fixture_data:
return fixture_data[path]
with open(path) as f: with open(path) as f:
data = f.read() data = f.read()
try: try:
data = json.loads(data) data = json.loads(data)
except Exception: except Exception:
pass pass
fixture_data[path] = data
return data return data

@ -16,22 +16,24 @@ if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7") raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock from ansible.compat.tests.mock import Mock
from ansible.compat.tests.mock import patch
from ansible.module_utils.f5_utils import AnsibleF5Client from ansible.module_utils.f5_utils import AnsibleF5Client
from ansible.module_utils.f5_utils import F5ModuleError from ansible.module_utils.f5_utils import F5ModuleError
from units.modules.utils import set_module_args
try: try:
from library.bigip_device_dns import Parameters from library.bigip_device_dns import Parameters
from library.bigip_device_dns import ModuleManager from library.bigip_device_dns import ModuleManager
from library.bigip_device_dns import ArgumentSpec from library.bigip_device_dns import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
except ImportError: except ImportError:
try: try:
from ansible.modules.network.f5.bigip_device_dns import Parameters from ansible.modules.network.f5.bigip_device_dns import Parameters
from ansible.modules.network.f5.bigip_device_dns import ModuleManager from ansible.modules.network.f5.bigip_device_dns import ModuleManager
from ansible.modules.network.f5.bigip_device_dns import ArgumentSpec from ansible.modules.network.f5.bigip_device_dns import ArgumentSpec
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from units.modules.utils import set_module_args
except ImportError: except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library") raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

@ -15,9 +15,9 @@ if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7") raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock from ansible.compat.tests.mock import Mock
from ansible.compat.tests.mock import patch
from ansible.module_utils.f5_utils import AnsibleF5Client from ansible.module_utils.f5_utils import AnsibleF5Client
from units.modules.utils import set_module_args
try: try:
from library.bigip_device_trust import Parameters from library.bigip_device_trust import Parameters
@ -26,6 +26,7 @@ try:
from library.bigip_device_trust import HAS_F5SDK from library.bigip_device_trust import HAS_F5SDK
from library.bigip_device_trust import HAS_NETADDR from library.bigip_device_trust import HAS_NETADDR
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args
except ImportError: except ImportError:
try: try:
from ansible.modules.network.f5.bigip_device_trust import Parameters from ansible.modules.network.f5.bigip_device_trust import Parameters
@ -34,6 +35,7 @@ except ImportError:
from ansible.modules.network.f5.bigip_device_trust import HAS_F5SDK from ansible.modules.network.f5.bigip_device_trust import HAS_F5SDK
from ansible.modules.network.f5.bigip_device_trust import HAS_NETADDR from ansible.modules.network.f5.bigip_device_trust import HAS_NETADDR
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
from units.modules.utils import set_module_args
except ImportError: except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library") raise SkipTest("F5 Ansible modules require the f5-sdk Python library")

Loading…
Cancel
Save