From e7d1c0fb77363d25a30627b4626f0a51aa3cf7c0 Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Mon, 19 Nov 2018 19:02:02 -0800 Subject: [PATCH] Removes f5-sdk references from bigip modules (#48911) --- .../f5/test_bigip_appsvcs_extension.py | 25 ++- .../network/f5/test_bigip_asm_policy.py | 28 ++-- .../network/f5/test_bigip_cli_alias.py | 22 ++- .../network/f5/test_bigip_cli_script.py | 22 ++- .../modules/network/f5/test_bigip_command.py | 24 ++- .../modules/network/f5/test_bigip_config.py | 20 ++- .../f5/test_bigip_configsync_action.py | 20 ++- .../network/f5/test_bigip_data_group.py | 28 ++-- .../network/f5/test_bigip_device_auth.py | 26 ++-- .../f5/test_bigip_device_connectivity.py | 24 ++- .../network/f5/test_bigip_device_dns.py | 20 ++- .../network/f5/test_bigip_device_facts.py | 46 +++--- .../network/f5/test_bigip_device_group.py | 22 ++- .../f5/test_bigip_device_group_member.py | 20 ++- .../network/f5/test_bigip_device_httpd.py | 20 ++- .../network/f5/test_bigip_device_license.py | 22 ++- .../network/f5/test_bigip_device_ntp.py | 20 ++- .../network/f5/test_bigip_device_sshd.py | 22 ++- .../network/f5/test_bigip_device_syslog.py | 22 ++- .../network/f5/test_bigip_device_trust.py | 21 +-- .../network/f5/test_bigip_dns_nameserver.py | 24 ++- .../network/f5/test_bigip_dns_resolver.py | 22 ++- .../modules/network/f5/test_bigip_dns_zone.py | 22 ++- .../f5/test_bigip_firewall_address_list.py | 22 ++- .../f5/test_bigip_firewall_dos_profile.py | 22 ++- .../f5/test_bigip_firewall_dos_vector.py | 24 ++- .../f5/test_bigip_firewall_global_rules.py | 22 ++- .../network/f5/test_bigip_firewall_policy.py | 22 ++- .../f5/test_bigip_firewall_port_list.py | 22 ++- .../network/f5/test_bigip_firewall_rule.py | 22 ++- .../f5/test_bigip_firewall_rule_list.py | 22 ++- .../network/f5/test_bigip_gtm_datacenter.py | 22 ++- .../network/f5/test_bigip_gtm_global.py | 22 ++- .../modules/network/f5/test_bigip_gtm_pool.py | 26 ++-- .../network/f5/test_bigip_gtm_pool_member.py | 22 ++- .../network/f5/test_bigip_gtm_server.py | 26 ++-- .../f5/test_bigip_gtm_virtual_server.py | 22 ++- .../network/f5/test_bigip_gtm_wide_ip.py | 28 ++-- .../modules/network/f5/test_bigip_hostname.py | 22 ++- .../network/f5/test_bigip_iapp_service.py | 24 ++- .../network/f5/test_bigip_iapp_template.py | 20 ++- .../network/f5/test_bigip_iapplx_package.py | 20 ++- .../modules/network/f5/test_bigip_ike_peer.py | 22 ++- .../network/f5/test_bigip_imish_config.py | 24 ++- .../network/f5/test_bigip_ipsec_policy.py | 22 ++- .../modules/network/f5/test_bigip_irule.py | 26 ++-- .../network/f5/test_bigip_log_destination.py | 30 ++-- .../network/f5/test_bigip_log_publisher.py | 24 ++- .../network/f5/test_bigip_management_route.py | 24 ++- .../modules/network/f5/test_bigip_node.py | 24 ++- .../network/f5/test_bigip_partition.py | 22 ++- .../modules/network/f5/test_bigip_policy.py | 24 ++- .../network/f5/test_bigip_policy_rule.py | 24 ++- .../modules/network/f5/test_bigip_pool.py | 24 ++- .../network/f5/test_bigip_pool_member.py | 24 ++- .../f5/test_bigip_profile_client_ssl.py | 22 ++- .../network/f5/test_bigip_profile_dns.py | 22 ++- .../network/f5/test_bigip_profile_fastl4.py | 22 ++- .../network/f5/test_bigip_profile_http.py | 22 ++- .../network/f5/test_bigip_profile_http2.py | 22 ++- .../f5/test_bigip_profile_http_compression.py | 24 ++- .../f5/test_bigip_profile_oneconnect.py | 22 ++- .../test_bigip_profile_persistence_cookie.py | 22 ++- ...test_bigip_profile_persistence_src_addr.py | 22 ++- .../f5/test_bigip_profile_server_ssl.py | 22 ++- .../network/f5/test_bigip_profile_tcp.py | 22 ++- .../network/f5/test_bigip_profile_udp.py | 22 ++- .../network/f5/test_bigip_provision.py | 20 ++- .../modules/network/f5/test_bigip_qkview.py | 24 ++- .../network/f5/test_bigip_remote_role.py | 36 ++--- .../network/f5/test_bigip_routedomain.py | 22 ++- .../modules/network/f5/test_bigip_selfip.py | 24 ++- .../network/f5/test_bigip_service_policy.py | 24 ++- .../modules/network/f5/test_bigip_smtp.py | 24 ++- .../network/f5/test_bigip_snat_pool.py | 22 ++- .../modules/network/f5/test_bigip_snmp.py | 22 ++- .../network/f5/test_bigip_snmp_community.py | 30 ++-- .../network/f5/test_bigip_snmp_trap.py | 28 ++-- .../network/f5/test_bigip_software_image.py | 24 ++- .../network/f5/test_bigip_software_install.py | 24 ++- .../network/f5/test_bigip_software_update.py | 22 ++- .../network/f5/test_bigip_ssl_certificate.py | 22 ++- .../modules/network/f5/test_bigip_ssl_key.py | 20 ++- .../modules/network/f5/test_bigip_ssl_ocsp.py | 22 ++- .../network/f5/test_bigip_static_route.py | 22 ++- .../f5/test_bigip_sys_daemon_log_tmm.py | 22 ++- .../modules/network/f5/test_bigip_sys_db.py | 20 ++- .../network/f5/test_bigip_sys_global.py | 22 ++- .../network/f5/test_bigip_timer_policy.py | 24 ++- .../network/f5/test_bigip_traffic_group.py | 22 ++- .../network/f5/test_bigip_traffic_selector.py | 22 ++- .../modules/network/f5/test_bigip_trunk.py | 24 ++- .../modules/network/f5/test_bigip_tunnel.py | 24 ++- .../modules/network/f5/test_bigip_ucs.py | 26 ++-- .../network/f5/test_bigip_ucs_fetch.py | 24 ++- .../modules/network/f5/test_bigip_user.py | 26 ++-- .../network/f5/test_bigip_vcmp_guest.py | 22 ++- .../network/f5/test_bigip_virtual_address.py | 22 ++- .../modules/network/f5/test_bigip_vlan.py | 22 ++- .../modules/network/f5/test_bigip_wait.py | 20 ++- .../f5/test_bigiq_application_fasthttp.py | 142 +++++++++++++----- .../f5/test_bigiq_application_fastl4_tcp.py | 24 ++- .../f5/test_bigiq_application_fastl4_udp.py | 24 ++- .../network/f5/test_bigiq_application_http.py | 24 ++- .../test_bigiq_application_https_offload.py | 24 ++- .../f5/test_bigiq_application_https_waf.py | 24 ++- .../network/f5/test_bigiq_device_facts.py | 22 ++- .../network/f5/test_bigiq_regkey_license.py | 22 ++- .../test_bigiq_regkey_license_assignment.py | 22 ++- .../network/f5/test_bigiq_regkey_pool.py | 22 ++- .../network/f5/test_bigiq_utility_license.py | 20 ++- .../test_bigiq_utility_license_assignment.py | 22 ++- 112 files changed, 1263 insertions(+), 1457 deletions(-) diff --git a/test/units/modules/network/f5/test_bigip_appsvcs_extension.py b/test/units/modules/network/f5/test_bigip_appsvcs_extension.py index 681e2b4372..01d9c8b3c3 100644 --- a/test/units/modules/network/f5/test_bigip_appsvcs_extension.py +++ b/test/units/modules/network/f5/test_bigip_appsvcs_extension.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_appsvcs_extension import ApiParameters - from ansible.modules.network.f5.bigip_appsvcs_extension import ModuleParameters - from ansible.modules.network.f5.bigip_appsvcs_extension import ModuleManager - from ansible.modules.network.f5.bigip_appsvcs_extension import ArgumentSpec + from ansible.modules.network.f5.bigip_appsvcs_extension import ApiParameters + from ansible.modules.network.f5.bigip_appsvcs_extension import ModuleParameters + from ansible.modules.network.f5.bigip_appsvcs_extension import ModuleManager + from ansible.modules.network.f5.bigip_appsvcs_extension import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -80,10 +78,7 @@ class TestParameters(unittest.TestCase): assert p.targets == ['T1', 'T2'] -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): - def setUp(self): self.spec = ArgumentSpec() diff --git a/test/units/modules/network/f5/test_bigip_asm_policy.py b/test/units/modules/network/f5/test_bigip_asm_policy.py index 38b284e824..5a2d3ec10d 100644 --- a/test/units/modules/network/f5/test_bigip_asm_policy.py +++ b/test/units/modules/network/f5/test_bigip_asm_policy.py @@ -34,24 +34,22 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_asm_policy import V1Parameters - from ansible.modules.network.f5.bigip_asm_policy import V2Parameters - from ansible.modules.network.f5.bigip_asm_policy import ModuleManager - from ansible.modules.network.f5.bigip_asm_policy import V1Manager - from ansible.modules.network.f5.bigip_asm_policy import V2Manager - from ansible.modules.network.f5.bigip_asm_policy import ArgumentSpec + from ansible.modules.network.f5.bigip_asm_policy import V1Parameters + from ansible.modules.network.f5.bigip_asm_policy import V2Parameters + from ansible.modules.network.f5.bigip_asm_policy import ModuleManager + from ansible.modules.network.f5.bigip_asm_policy import V1Manager + from ansible.modules.network.f5.bigip_asm_policy import V2Manager + from ansible.modules.network.f5.bigip_asm_policy import ArgumentSpec - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_cli_alias.py b/test/units/modules/network/f5/test_bigip_cli_alias.py index 6f525d32f9..a029134cab 100644 --- a/test/units/modules/network/f5/test_bigip_cli_alias.py +++ b/test/units/modules/network/f5/test_bigip_cli_alias.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_cli_alias import ApiParameters - from ansible.modules.network.f5.bigip_cli_alias import ModuleParameters - from ansible.modules.network.f5.bigip_cli_alias import ModuleManager - from ansible.modules.network.f5.bigip_cli_alias import ArgumentSpec + from ansible.modules.network.f5.bigip_cli_alias import ApiParameters + from ansible.modules.network.f5.bigip_cli_alias import ModuleParameters + from ansible.modules.network.f5.bigip_cli_alias import ModuleManager + from ansible.modules.network.f5.bigip_cli_alias import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_cli_script.py b/test/units/modules/network/f5/test_bigip_cli_script.py index bf2432c895..a5a51ac335 100644 --- a/test/units/modules/network/f5/test_bigip_cli_script.py +++ b/test/units/modules/network/f5/test_bigip_cli_script.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_cli_script import ApiParameters - from ansible.modules.network.f5.bigip_cli_script import ModuleParameters - from ansible.modules.network.f5.bigip_cli_script import ModuleManager - from ansible.modules.network.f5.bigip_cli_script import ArgumentSpec + from ansible.modules.network.f5.bigip_cli_script import ApiParameters + from ansible.modules.network.f5.bigip_cli_script import ModuleParameters + from ansible.modules.network.f5.bigip_cli_script import ModuleManager + from ansible.modules.network.f5.bigip_cli_script import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_command.py b/test/units/modules/network/f5/test_bigip_command.py index d8987ee5c5..c386611247 100644 --- a/test/units/modules/network/f5/test_bigip_command.py +++ b/test/units/modules/network/f5/test_bigip_command.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_command import Parameters - from ansible.modules.network.f5.bigip_command import ModuleManager - from ansible.modules.network.f5.bigip_command import V1Manager - from ansible.modules.network.f5.bigip_command import V2Manager - from ansible.modules.network.f5.bigip_command import ArgumentSpec + from ansible.modules.network.f5.bigip_command import Parameters + from ansible.modules.network.f5.bigip_command import ModuleManager + from ansible.modules.network.f5.bigip_command import V1Manager + from ansible.modules.network.f5.bigip_command import V2Manager + from ansible.modules.network.f5.bigip_command import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_config.py b/test/units/modules/network/f5/test_bigip_config.py index 0b70617701..e9edebf2f9 100644 --- a/test/units/modules/network/f5/test_bigip_config.py +++ b/test/units/modules/network/f5/test_bigip_config.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_config import Parameters - from ansible.modules.network.f5.bigip_config import ModuleManager - from ansible.modules.network.f5.bigip_config import ArgumentSpec + from ansible.modules.network.f5.bigip_config import Parameters + from ansible.modules.network.f5.bigip_config import ModuleManager + from ansible.modules.network.f5.bigip_config import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_configsync_action.py b/test/units/modules/network/f5/test_bigip_configsync_action.py index df4dcefe0d..3990dcfe43 100644 --- a/test/units/modules/network/f5/test_bigip_configsync_action.py +++ b/test/units/modules/network/f5/test_bigip_configsync_action.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_configsync_action import Parameters - from ansible.modules.network.f5.bigip_configsync_action import ModuleManager - from ansible.modules.network.f5.bigip_configsync_action import ArgumentSpec + from ansible.modules.network.f5.bigip_configsync_action import Parameters + from ansible.modules.network.f5.bigip_configsync_action import ModuleManager + from ansible.modules.network.f5.bigip_configsync_action import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_data_group.py b/test/units/modules/network/f5/test_bigip_data_group.py index 1352c15b65..415a98d078 100644 --- a/test/units/modules/network/f5/test_bigip_data_group.py +++ b/test/units/modules/network/f5/test_bigip_data_group.py @@ -33,23 +33,21 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_data_group import ModuleParameters - from ansible.modules.network.f5.bigip_data_group import ModuleManager - from ansible.modules.network.f5.bigip_data_group import ExternalManager - from ansible.modules.network.f5.bigip_data_group import InternalManager - from ansible.modules.network.f5.bigip_data_group import ArgumentSpec + from ansible.modules.network.f5.bigip_data_group import ModuleParameters + from ansible.modules.network.f5.bigip_data_group import ModuleManager + from ansible.modules.network.f5.bigip_data_group import ExternalManager + from ansible.modules.network.f5.bigip_data_group import InternalManager + from ansible.modules.network.f5.bigip_data_group import ArgumentSpec - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -105,8 +103,6 @@ class TestParameters(unittest.TestCase): assert p.partition == 'Common' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_device_auth.py b/test/units/modules/network/f5/test_bigip_device_auth.py index b470c788b9..a4d781f60b 100644 --- a/test/units/modules/network/f5/test_bigip_device_auth.py +++ b/test/units/modules/network/f5/test_bigip_device_auth.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_sys_auth import TacacsApiParameters - from ansible.modules.network.f5.bigip_sys_auth import TacacsModuleParameters - from ansible.modules.network.f5.bigip_sys_auth import TacacsManager - from ansible.modules.network.f5.bigip_sys_auth import ModuleManager - from ansible.modules.network.f5.bigip_sys_auth import ArgumentSpec + from ansible.modules.network.f5.bigip_device_auth import TacacsApiParameters + from ansible.modules.network.f5.bigip_device_auth import TacacsModuleParameters + from ansible.modules.network.f5.bigip_device_auth import TacacsManager + from ansible.modules.network.f5.bigip_device_auth import ModuleManager + from ansible.modules.network.f5.bigip_device_auth import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -94,8 +92,6 @@ class TestParameters(unittest.TestCase): assert p.service_name == 'ppp' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_device_connectivity.py b/test/units/modules/network/f5/test_bigip_device_connectivity.py index b2db42aa9b..bb8d749d30 100644 --- a/test/units/modules/network/f5/test_bigip_device_connectivity.py +++ b/test/units/modules/network/f5/test_bigip_device_connectivity.py @@ -32,22 +32,20 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_connectivity import ApiParameters - from ansible.modules.network.f5.bigip_device_connectivity import ModuleParameters - 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 ApiParameters + from ansible.modules.network.f5.bigip_device_connectivity import ModuleParameters + from ansible.modules.network.f5.bigip_device_connectivity import ModuleManager + from ansible.modules.network.f5.bigip_device_connectivity import ArgumentSpec - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_dns.py b/test/units/modules/network/f5/test_bigip_device_dns.py index de58114430..2d99111895 100644 --- a/test/units/modules/network/f5/test_bigip_device_dns.py +++ b/test/units/modules/network/f5/test_bigip_device_dns.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - 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 ArgumentSpec + 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 ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_facts.py b/test/units/modules/network/f5/test_bigip_device_facts.py index b272cae7f0..0b94145ef4 100644 --- a/test/units/modules/network/f5/test_bigip_device_facts.py +++ b/test/units/modules/network/f5/test_bigip_device_facts.py @@ -24,9 +24,6 @@ try: from library.modules.bigip_device_facts import ArgumentSpec from library.modules.bigip_device_facts import ModuleManager - from f5.bigip.tm.gtm.pool import A - from f5.utils.responses.handlers import Stats - # In Ansible 2.8, Ansible changed import paths. from test.units.compat import unittest from test.units.compat.mock import Mock @@ -34,24 +31,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_pool import Parameters - from ansible.modules.network.f5.bigip_device_pool import VirtualAddressesFactManager - from ansible.modules.network.f5.bigip_device_pool import VirtualAddressesParameters - from ansible.modules.network.f5.bigip_device_pool import ArgumentSpec - from ansible.modules.network.f5.bigip_device_pool import ModuleManager + from ansible.modules.network.f5.bigip_device_facts import Parameters + from ansible.modules.network.f5.bigip_device_facts import VirtualAddressesFactManager + from ansible.modules.network.f5.bigip_device_facts import VirtualAddressesParameters + from ansible.modules.network.f5.bigip_device_facts import ArgumentSpec + from ansible.modules.network.f5.bigip_device_facts import ModuleManager - from f5.bigip.tm.gtm.pool import A - from f5.utils.responses.handlers import Stats + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -75,9 +67,9 @@ def load_fixture(name): return data -class FakeVirtualAddress(A): +class FakeVirtualAddress: def __init__(self, *args, **kwargs): - attrs = kwargs.pop('attrs', {}) + attrs = kwargs.pop('params', {}) for key, value in iteritems(attrs): setattr(self, key, value) @@ -96,6 +88,18 @@ class TestManager(unittest.TestCase): def setUp(self): self.spec = ArgumentSpec() + try: + self.p1 = patch('library.modules.bigip_device_facts.modules_provisioned') + self.m1 = self.p1.start() + self.m1.return_value = ['ltm', 'gtm', 'asm'] + except Exception: + self.p1 = patch('ansible.modules.network.f5.bigip_device_facts.modules_provisioned') + self.m1 = self.p1.start() + self.m1.return_value = ['ltm', 'gtm', 'asm'] + + def tearDown(self): + self.p1.stop() + def test_get_trunk_facts(self, *args): set_module_args(dict( gather_subset=['virtual-addresses'], @@ -105,7 +109,7 @@ class TestManager(unittest.TestCase): )) fixture1 = load_fixture('load_ltm_virtual_address_collection_1.json') - collection = [FakeVirtualAddress(attrs=x) for x in fixture1['items']] + collection = fixture1['items'] module = AnsibleModule( argument_spec=self.spec.argument_spec, diff --git a/test/units/modules/network/f5/test_bigip_device_group.py b/test/units/modules/network/f5/test_bigip_device_group.py index 1b819eb313..1dd99122ed 100644 --- a/test/units/modules/network/f5/test_bigip_device_group.py +++ b/test/units/modules/network/f5/test_bigip_device_group.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_group import ApiParameters - from ansible.modules.network.f5.bigip_device_group import ModuleParameters - from ansible.modules.network.f5.bigip_device_group import ModuleManager - from ansible.modules.network.f5.bigip_device_group import ArgumentSpec + from ansible.modules.network.f5.bigip_device_group import ApiParameters + from ansible.modules.network.f5.bigip_device_group import ModuleParameters + from ansible.modules.network.f5.bigip_device_group import ModuleManager + from ansible.modules.network.f5.bigip_device_group import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_group_member.py b/test/units/modules/network/f5/test_bigip_device_group_member.py index de8145415e..a87678d3b8 100644 --- a/test/units/modules/network/f5/test_bigip_device_group_member.py +++ b/test/units/modules/network/f5/test_bigip_device_group_member.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_group_member import Parameters - from ansible.modules.network.f5.bigip_device_group_member import ModuleManager - from ansible.modules.network.f5.bigip_device_group_member import ArgumentSpec + from ansible.modules.network.f5.bigip_device_group_member import Parameters + from ansible.modules.network.f5.bigip_device_group_member import ModuleManager + from ansible.modules.network.f5.bigip_device_group_member import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_httpd.py b/test/units/modules/network/f5/test_bigip_device_httpd.py index 2f2823d376..b0939814db 100644 --- a/test/units/modules/network/f5/test_bigip_device_httpd.py +++ b/test/units/modules/network/f5/test_bigip_device_httpd.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_httpd import Parameters - from ansible.modules.network.f5.bigip_device_httpd import ModuleManager - from ansible.modules.network.f5.bigip_device_httpd import ArgumentSpec + from ansible.modules.network.f5.bigip_device_httpd import Parameters + from ansible.modules.network.f5.bigip_device_httpd import ModuleManager + from ansible.modules.network.f5.bigip_device_httpd import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_license.py b/test/units/modules/network/f5/test_bigip_device_license.py index 5aedfc0324..ac4d38ae35 100644 --- a/test/units/modules/network/f5/test_bigip_device_license.py +++ b/test/units/modules/network/f5/test_bigip_device_license.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_license import ApiParameters - from ansible.modules.network.f5.bigip_device_license import ModuleParameters - from ansible.modules.network.f5.bigip_device_license import ModuleManager - from ansible.modules.network.f5.bigip_device_license import ArgumentSpec + from ansible.modules.network.f5.bigip_device_license import ApiParameters + from ansible.modules.network.f5.bigip_device_license import ModuleParameters + from ansible.modules.network.f5.bigip_device_license import ModuleManager + from ansible.modules.network.f5.bigip_device_license import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_ntp.py b/test/units/modules/network/f5/test_bigip_device_ntp.py index 86b75fbb4f..b174710cfe 100644 --- a/test/units/modules/network/f5/test_bigip_device_ntp.py +++ b/test/units/modules/network/f5/test_bigip_device_ntp.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_ntp import Parameters - from ansible.modules.network.f5.bigip_device_ntp import ModuleManager - from ansible.modules.network.f5.bigip_device_ntp import ArgumentSpec + from ansible.modules.network.f5.bigip_device_ntp import Parameters + from ansible.modules.network.f5.bigip_device_ntp import ModuleManager + from ansible.modules.network.f5.bigip_device_ntp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_sshd.py b/test/units/modules/network/f5/test_bigip_device_sshd.py index d07fd899ff..0c1564b6fb 100644 --- a/test/units/modules/network/f5/test_bigip_device_sshd.py +++ b/test/units/modules/network/f5/test_bigip_device_sshd.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_sshd import ApiParameters - from ansible.modules.network.f5.bigip_device_sshd import ModuleParameters - from ansible.modules.network.f5.bigip_device_sshd import ModuleManager - from ansible.modules.network.f5.bigip_device_sshd import ArgumentSpec + from ansible.modules.network.f5.bigip_device_sshd import ApiParameters + from ansible.modules.network.f5.bigip_device_sshd import ModuleParameters + from ansible.modules.network.f5.bigip_device_sshd import ModuleManager + from ansible.modules.network.f5.bigip_device_sshd import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_syslog.py b/test/units/modules/network/f5/test_bigip_device_syslog.py index fdaf3fdbd6..f6a33f4778 100644 --- a/test/units/modules/network/f5/test_bigip_device_syslog.py +++ b/test/units/modules/network/f5/test_bigip_device_syslog.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_syslog import ApiParameters - from ansible.modules.network.f5.bigip_device_syslog import ModuleParameters - from ansible.modules.network.f5.bigip_device_syslog import ModuleManager - from ansible.modules.network.f5.bigip_device_syslog import ArgumentSpec + from ansible.modules.network.f5.bigip_device_syslog import ApiParameters + from ansible.modules.network.f5.bigip_device_syslog import ModuleParameters + from ansible.modules.network.f5.bigip_device_syslog import ModuleManager + from ansible.modules.network.f5.bigip_device_syslog import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_device_trust.py b/test/units/modules/network/f5/test_bigip_device_trust.py index c9e5562a61..95b3757fd9 100644 --- a/test/units/modules/network/f5/test_bigip_device_trust.py +++ b/test/units/modules/network/f5/test_bigip_device_trust.py @@ -20,7 +20,6 @@ try: from library.modules.bigip_device_trust import Parameters from library.modules.bigip_device_trust import ModuleManager from library.modules.bigip_device_trust import ArgumentSpec - from library.modules.bigip_device_trust import HAS_F5SDK # In Ansible 2.8, Ansible changed import paths. from test.units.compat import unittest @@ -29,20 +28,16 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_device_trust import Parameters - from ansible.modules.network.f5.bigip_device_trust import ModuleManager - from ansible.modules.network.f5.bigip_device_trust import ArgumentSpec - from ansible.modules.network.f5.bigip_device_trust import HAS_F5SDK + from ansible.modules.network.f5.bigip_device_trust import Parameters + from ansible.modules.network.f5.bigip_device_trust import ModuleManager + from ansible.modules.network.f5.bigip_device_trust import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") + from units.modules.utils import set_module_args fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') diff --git a/test/units/modules/network/f5/test_bigip_dns_nameserver.py b/test/units/modules/network/f5/test_bigip_dns_nameserver.py index 3d16c07373..35b0637e86 100644 --- a/test/units/modules/network/f5/test_bigip_dns_nameserver.py +++ b/test/units/modules/network/f5/test_bigip_dns_nameserver.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_dns_nameserver import ApiParameters - from ansible.modules.network.f5.bigip_dns_nameserver import ModuleParameters - from ansible.modules.network.f5.bigip_dns_nameserver import ModuleManager - from ansible.modules.network.f5.bigip_dns_nameserver import ArgumentSpec + from ansible.modules.network.f5.bigip_dns_nameserver import ApiParameters + from ansible.modules.network.f5.bigip_dns_nameserver import ModuleParameters + from ansible.modules.network.f5.bigip_dns_nameserver import ModuleManager + from ansible.modules.network.f5.bigip_dns_nameserver import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -95,8 +93,6 @@ class TestParameters(unittest.TestCase): assert p.tsig_key == '/Common/key1' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_dns_resolver.py b/test/units/modules/network/f5/test_bigip_dns_resolver.py index c4edfc6639..da0b57a2e6 100644 --- a/test/units/modules/network/f5/test_bigip_dns_resolver.py +++ b/test/units/modules/network/f5/test_bigip_dns_resolver.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_dns_resolver import ApiParameters - from ansible.modules.network.f5.bigip_dns_resolver import ModuleParameters - from ansible.modules.network.f5.bigip_dns_resolver import ModuleManager - from ansible.modules.network.f5.bigip_dns_resolver import ArgumentSpec + from ansible.modules.network.f5.bigip_dns_resolver import ApiParameters + from ansible.modules.network.f5.bigip_dns_resolver import ModuleParameters + from ansible.modules.network.f5.bigip_dns_resolver import ModuleManager + from ansible.modules.network.f5.bigip_dns_resolver import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_dns_zone.py b/test/units/modules/network/f5/test_bigip_dns_zone.py index 1fadae7ded..af47801337 100644 --- a/test/units/modules/network/f5/test_bigip_dns_zone.py +++ b/test/units/modules/network/f5/test_bigip_dns_zone.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_dns_zone import ApiParameters - from ansible.modules.network.f5.bigip_dns_zone import ModuleParameters - from ansible.modules.network.f5.bigip_dns_zone import ModuleManager - from ansible.modules.network.f5.bigip_dns_zone import ArgumentSpec + from ansible.modules.network.f5.bigip_dns_zone import ApiParameters + from ansible.modules.network.f5.bigip_dns_zone import ModuleParameters + from ansible.modules.network.f5.bigip_dns_zone import ModuleManager + from ansible.modules.network.f5.bigip_dns_zone import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_address_list.py b/test/units/modules/network/f5/test_bigip_firewall_address_list.py index 1ffc394eff..d9a79b1c13 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_address_list.py +++ b/test/units/modules/network/f5/test_bigip_firewall_address_list.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_address_list import ApiParameters - from ansible.modules.network.f5.bigip_firewall_address_list import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_address_list import ModuleManager - from ansible.modules.network.f5.bigip_firewall_address_list import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_address_list import ApiParameters + from ansible.modules.network.f5.bigip_firewall_address_list import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_address_list import ModuleManager + from ansible.modules.network.f5.bigip_firewall_address_list import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_dos_profile.py b/test/units/modules/network/f5/test_bigip_firewall_dos_profile.py index c9d5ba4ae7..e90ee571d4 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_dos_profile.py +++ b/test/units/modules/network/f5/test_bigip_firewall_dos_profile.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_dos_profile import ApiParameters - from ansible.modules.network.f5.bigip_firewall_dos_profile import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_dos_profile import ModuleManager - from ansible.modules.network.f5.bigip_firewall_dos_profile import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_dos_profile import ApiParameters + from ansible.modules.network.f5.bigip_firewall_dos_profile import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_dos_profile import ModuleManager + from ansible.modules.network.f5.bigip_firewall_dos_profile import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_dos_vector.py b/test/units/modules/network/f5/test_bigip_firewall_dos_vector.py index 3a758f8100..3c38c0de28 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_dos_vector.py +++ b/test/units/modules/network/f5/test_bigip_firewall_dos_vector.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_dos_vector import ApiParameters - from ansible.modules.network.f5.bigip_firewall_dos_vector import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_dos_vector import ModuleManager - from ansible.modules.network.f5.bigip_firewall_dos_vector import ArgumentSpec - from ansible.modules.network.f5.bigip_firewall_dos_vector import ProtocolDnsManager + from ansible.modules.network.f5.bigip_firewall_dos_vector import ApiParameters + from ansible.modules.network.f5.bigip_firewall_dos_vector import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_dos_vector import ModuleManager + from ansible.modules.network.f5.bigip_firewall_dos_vector import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_dos_vector import ProtocolDnsManager - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_global_rules.py b/test/units/modules/network/f5/test_bigip_firewall_global_rules.py index 7aa38e8f80..2b2383fe7d 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_global_rules.py +++ b/test/units/modules/network/f5/test_bigip_firewall_global_rules.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_global_rules import ApiParameters - from ansible.modules.network.f5.bigip_firewall_global_rules import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_global_rules import ModuleManager - from ansible.modules.network.f5.bigip_firewall_global_rules import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_global_rules import ApiParameters + from ansible.modules.network.f5.bigip_firewall_global_rules import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_global_rules import ModuleManager + from ansible.modules.network.f5.bigip_firewall_global_rules import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_policy.py b/test/units/modules/network/f5/test_bigip_firewall_policy.py index b6c17fa4c8..bb7e85977b 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_policy.py +++ b/test/units/modules/network/f5/test_bigip_firewall_policy.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_policy import ApiParameters - from ansible.modules.network.f5.bigip_firewall_policy import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_policy import ModuleManager - from ansible.modules.network.f5.bigip_firewall_policy import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_policy import ApiParameters + from ansible.modules.network.f5.bigip_firewall_policy import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_policy import ModuleManager + from ansible.modules.network.f5.bigip_firewall_policy import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_port_list.py b/test/units/modules/network/f5/test_bigip_firewall_port_list.py index 1c1bb65199..33155a72a3 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_port_list.py +++ b/test/units/modules/network/f5/test_bigip_firewall_port_list.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_port_list import ApiParameters - from ansible.modules.network.f5.bigip_firewall_port_list import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_port_list import ModuleManager - from ansible.modules.network.f5.bigip_firewall_port_list import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_port_list import ApiParameters + from ansible.modules.network.f5.bigip_firewall_port_list import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_port_list import ModuleManager + from ansible.modules.network.f5.bigip_firewall_port_list import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_rule.py b/test/units/modules/network/f5/test_bigip_firewall_rule.py index 741c93c4cf..8d1f45b845 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_rule.py +++ b/test/units/modules/network/f5/test_bigip_firewall_rule.py @@ -30,20 +30,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_rule import ApiParameters - from ansible.modules.network.f5.bigip_firewall_rule import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_rule import ModuleManager - from ansible.modules.network.f5.bigip_firewall_rule import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_rule import ApiParameters + from ansible.modules.network.f5.bigip_firewall_rule import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_rule import ModuleManager + from ansible.modules.network.f5.bigip_firewall_rule import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_firewall_rule_list.py b/test/units/modules/network/f5/test_bigip_firewall_rule_list.py index 894b4ff2f2..5b20681c3c 100644 --- a/test/units/modules/network/f5/test_bigip_firewall_rule_list.py +++ b/test/units/modules/network/f5/test_bigip_firewall_rule_list.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_firewall_rule_list import ModuleParameters - from ansible.modules.network.f5.bigip_firewall_rule_list import ApiParameters - from ansible.modules.network.f5.bigip_firewall_rule_list import ModuleManager - from ansible.modules.network.f5.bigip_firewall_rule_list import ArgumentSpec + from ansible.modules.network.f5.bigip_firewall_rule_list import ModuleParameters + from ansible.modules.network.f5.bigip_firewall_rule_list import ApiParameters + from ansible.modules.network.f5.bigip_firewall_rule_list import ModuleManager + from ansible.modules.network.f5.bigip_firewall_rule_list import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_gtm_datacenter.py b/test/units/modules/network/f5/test_bigip_gtm_datacenter.py index c1d6c032bc..e7d020e9e4 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_datacenter.py +++ b/test/units/modules/network/f5/test_bigip_gtm_datacenter.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_gtm_datacenter import ApiParameters - from ansible.modules.network.f5.bigip_gtm_datacenter import ModuleParameters - from ansible.modules.network.f5.bigip_gtm_datacenter import ModuleManager - from ansible.modules.network.f5.bigip_gtm_datacenter import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_datacenter import ApiParameters + from ansible.modules.network.f5.bigip_gtm_datacenter import ModuleParameters + from ansible.modules.network.f5.bigip_gtm_datacenter import ModuleManager + from ansible.modules.network.f5.bigip_gtm_datacenter import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_gtm_global.py b/test/units/modules/network/f5/test_bigip_gtm_global.py index 5fb8658b04..362a8857aa 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_global.py +++ b/test/units/modules/network/f5/test_bigip_gtm_global.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_gtm_global import ApiParameters - from ansible.modules.network.f5.bigip_gtm_global import ModuleParameters - from ansible.modules.network.f5.bigip_gtm_global import ModuleManager - from ansible.modules.network.f5.bigip_gtm_global import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_global import ApiParameters + from ansible.modules.network.f5.bigip_gtm_global import ModuleParameters + from ansible.modules.network.f5.bigip_gtm_global import ModuleManager + from ansible.modules.network.f5.bigip_gtm_global import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_gtm_pool.py b/test/units/modules/network/f5/test_bigip_gtm_pool.py index 1f33812755..512a814445 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_pool.py +++ b/test/units/modules/network/f5/test_bigip_gtm_pool.py @@ -31,22 +31,20 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_gtm_pool import ApiParameters - from ansible.modules.network.f5.bigip_gtm_pool import ModuleParameters - from ansible.modules.network.f5.bigip_gtm_pool import ModuleManager - from ansible.modules.network.f5.bigip_gtm_pool import ArgumentSpec - from ansible.modules.network.f5.bigip_gtm_pool import UntypedManager - from ansible.modules.network.f5.bigip_gtm_pool import TypedManager + from ansible.modules.network.f5.bigip_gtm_pool import ApiParameters + from ansible.modules.network.f5.bigip_gtm_pool import ModuleParameters + from ansible.modules.network.f5.bigip_gtm_pool import ModuleManager + from ansible.modules.network.f5.bigip_gtm_pool import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_pool import UntypedManager + from ansible.modules.network.f5.bigip_gtm_pool import TypedManager - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_gtm_pool_member.py b/test/units/modules/network/f5/test_bigip_gtm_pool_member.py index 6b90a71cec..e2c9287716 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_pool_member.py +++ b/test/units/modules/network/f5/test_bigip_gtm_pool_member.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_gtm_pool_member import ApiParameters - from ansible.modules.network.f5.bigip_gtm_pool_member import ModuleParameters - from ansible.modules.network.f5.bigip_gtm_pool_member import ModuleManager - from ansible.modules.network.f5.bigip_gtm_pool_member import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_pool_member import ApiParameters + from ansible.modules.network.f5.bigip_gtm_pool_member import ModuleParameters + from ansible.modules.network.f5.bigip_gtm_pool_member import ModuleManager + from ansible.modules.network.f5.bigip_gtm_pool_member import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_gtm_server.py b/test/units/modules/network/f5/test_bigip_gtm_server.py index 26e6acd64b..a00207500c 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_server.py +++ b/test/units/modules/network/f5/test_bigip_gtm_server.py @@ -31,22 +31,20 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_gtm_server import ApiParameters - from ansible.modules.network.f5.bigip_gtm_server import ModuleParameters - from ansible.modules.network.f5.bigip_gtm_server import ModuleManager - from ansible.modules.network.f5.bigip_gtm_server import V1Manager - from ansible.modules.network.f5.bigip_gtm_server import V2Manager - from ansible.modules.network.f5.bigip_gtm_server import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_server import ApiParameters + from ansible.modules.network.f5.bigip_gtm_server import ModuleParameters + from ansible.modules.network.f5.bigip_gtm_server import ModuleManager + from ansible.modules.network.f5.bigip_gtm_server import V1Manager + from ansible.modules.network.f5.bigip_gtm_server import V2Manager + from ansible.modules.network.f5.bigip_gtm_server import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_gtm_virtual_server.py b/test/units/modules/network/f5/test_bigip_gtm_virtual_server.py index 3a950af02d..e39a2a378e 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_virtual_server.py +++ b/test/units/modules/network/f5/test_bigip_gtm_virtual_server.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_gtm_virtual_server import ApiParameters - from ansible.modules.network.f5.bigip_gtm_virtual_server import ModuleParameters - from ansible.modules.network.f5.bigip_gtm_virtual_server import ModuleManager - from ansible.modules.network.f5.bigip_gtm_virtual_server import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_virtual_server import ApiParameters + from ansible.modules.network.f5.bigip_gtm_virtual_server import ModuleParameters + from ansible.modules.network.f5.bigip_gtm_virtual_server import ModuleManager + from ansible.modules.network.f5.bigip_gtm_virtual_server import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py b/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py index 17255c8b84..357375bc24 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py +++ b/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py @@ -34,24 +34,22 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_gtm_wide_ip import ApiParameters - from ansible.modules.network.f5.bigip_gtm_wide_ip import ModuleParameters - from ansible.modules.network.f5.bigip_gtm_wide_ip import ModuleManager - from ansible.modules.network.f5.bigip_gtm_wide_ip import ArgumentSpec - from ansible.modules.network.f5.bigip_gtm_wide_ip import UntypedManager - from ansible.modules.network.f5.bigip_gtm_wide_ip import TypedManager + from ansible.modules.network.f5.bigip_gtm_wide_ip import ApiParameters + from ansible.modules.network.f5.bigip_gtm_wide_ip import ModuleParameters + from ansible.modules.network.f5.bigip_gtm_wide_ip import ModuleManager + from ansible.modules.network.f5.bigip_gtm_wide_ip import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_wide_ip import UntypedManager + from ansible.modules.network.f5.bigip_gtm_wide_ip import TypedManager - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_hostname.py b/test/units/modules/network/f5/test_bigip_hostname.py index 9df6d8fb13..cc594997aa 100644 --- a/test/units/modules/network/f5/test_bigip_hostname.py +++ b/test/units/modules/network/f5/test_bigip_hostname.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_hostname import ApiParameters - from ansible.modules.network.f5.bigip_hostname import ModuleParameters - from ansible.modules.network.f5.bigip_hostname import ModuleManager - from ansible.modules.network.f5.bigip_hostname import ArgumentSpec + from ansible.modules.network.f5.bigip_hostname import ApiParameters + from ansible.modules.network.f5.bigip_hostname import ModuleParameters + from ansible.modules.network.f5.bigip_hostname import ModuleManager + from ansible.modules.network.f5.bigip_hostname import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_iapp_service.py b/test/units/modules/network/f5/test_bigip_iapp_service.py index 6935e9a79e..cc40a6cfc9 100644 --- a/test/units/modules/network/f5/test_bigip_iapp_service.py +++ b/test/units/modules/network/f5/test_bigip_iapp_service.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_iapp_service import Parameters - from ansible.modules.network.f5.bigip_iapp_service import ApiParameters - from ansible.modules.network.f5.bigip_iapp_service import ModuleParameters - from ansible.modules.network.f5.bigip_iapp_service import ModuleManager - from ansible.modules.network.f5.bigip_iapp_service import ArgumentSpec + from ansible.modules.network.f5.bigip_iapp_service import Parameters + from ansible.modules.network.f5.bigip_iapp_service import ApiParameters + from ansible.modules.network.f5.bigip_iapp_service import ModuleParameters + from ansible.modules.network.f5.bigip_iapp_service import ModuleManager + from ansible.modules.network.f5.bigip_iapp_service import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_iapp_template.py b/test/units/modules/network/f5/test_bigip_iapp_template.py index 03106817f6..781fcf0897 100644 --- a/test/units/modules/network/f5/test_bigip_iapp_template.py +++ b/test/units/modules/network/f5/test_bigip_iapp_template.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_iapp_template import Parameters - from ansible.modules.network.f5.bigip_iapp_template import ArgumentSpec - from ansible.modules.network.f5.bigip_iapp_template import ModuleManager + from ansible.modules.network.f5.bigip_iapp_template import Parameters + from ansible.modules.network.f5.bigip_iapp_template import ArgumentSpec + from ansible.modules.network.f5.bigip_iapp_template import ModuleManager - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_iapplx_package.py b/test/units/modules/network/f5/test_bigip_iapplx_package.py index 1117cb0d09..33167a1d09 100644 --- a/test/units/modules/network/f5/test_bigip_iapplx_package.py +++ b/test/units/modules/network/f5/test_bigip_iapplx_package.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_iapp_template import Parameters - from ansible.modules.network.f5.bigip_iapp_template import ArgumentSpec - from ansible.modules.network.f5.bigip_iapp_template import ModuleManager + from ansible.modules.network.f5.bigip_iapp_template import Parameters + from ansible.modules.network.f5.bigip_iapp_template import ArgumentSpec + from ansible.modules.network.f5.bigip_iapp_template import ModuleManager - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_ike_peer.py b/test/units/modules/network/f5/test_bigip_ike_peer.py index 21edd9d51d..0f2ec04c3e 100644 --- a/test/units/modules/network/f5/test_bigip_ike_peer.py +++ b/test/units/modules/network/f5/test_bigip_ike_peer.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_ike_peer import ApiParameters - from ansible.modules.network.f5.bigip_ike_peer import ModuleParameters - from ansible.modules.network.f5.bigip_ike_peer import ModuleManager - from ansible.modules.network.f5.bigip_ike_peer import ArgumentSpec + from ansible.modules.network.f5.bigip_ike_peer import ApiParameters + from ansible.modules.network.f5.bigip_ike_peer import ModuleParameters + from ansible.modules.network.f5.bigip_ike_peer import ModuleManager + from ansible.modules.network.f5.bigip_ike_peer import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_imish_config.py b/test/units/modules/network/f5/test_bigip_imish_config.py index cf23b8883c..332c8bfcb5 100644 --- a/test/units/modules/network/f5/test_bigip_imish_config.py +++ b/test/units/modules/network/f5/test_bigip_imish_config.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_imish_config import ApiParameters - from ansible.modules.network.f5.bigip_imish_config import ModuleParameters - from ansible.modules.network.f5.bigip_imish_config import ModuleManager - from ansible.modules.network.f5.bigip_imish_config import ArgumentSpec + from ansible.modules.network.f5.bigip_imish_config import ApiParameters + from ansible.modules.network.f5.bigip_imish_config import ModuleParameters + from ansible.modules.network.f5.bigip_imish_config import ModuleManager + from ansible.modules.network.f5.bigip_imish_config import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -66,8 +64,6 @@ def load_fixture(name): return data -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_ipsec_policy.py b/test/units/modules/network/f5/test_bigip_ipsec_policy.py index 7ccca9bbe2..4659527df7 100644 --- a/test/units/modules/network/f5/test_bigip_ipsec_policy.py +++ b/test/units/modules/network/f5/test_bigip_ipsec_policy.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_ipsec_policy import ApiParameters - from ansible.modules.network.f5.bigip_ipsec_policy import ModuleParameters - from ansible.modules.network.f5.bigip_ipsec_policy import ModuleManager - from ansible.modules.network.f5.bigip_ipsec_policy import ArgumentSpec + from ansible.modules.network.f5.bigip_ipsec_policy import ApiParameters + from ansible.modules.network.f5.bigip_ipsec_policy import ModuleParameters + from ansible.modules.network.f5.bigip_ipsec_policy import ModuleManager + from ansible.modules.network.f5.bigip_ipsec_policy import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_irule.py b/test/units/modules/network/f5/test_bigip_irule.py index 5682d25bf2..4a0ea65e8a 100644 --- a/test/units/modules/network/f5/test_bigip_irule.py +++ b/test/units/modules/network/f5/test_bigip_irule.py @@ -32,22 +32,20 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_irule import Parameters - from ansible.modules.network.f5.bigip_irule import ModuleManager - from ansible.modules.network.f5.bigip_irule import ArgumentSpec - from ansible.modules.network.f5.bigip_irule import GtmManager - from ansible.modules.network.f5.bigip_irule import LtmManager + from ansible.modules.network.f5.bigip_irule import Parameters + from ansible.modules.network.f5.bigip_irule import ModuleManager + from ansible.modules.network.f5.bigip_irule import ArgumentSpec + from ansible.modules.network.f5.bigip_irule import GtmManager + from ansible.modules.network.f5.bigip_irule import LtmManager - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch - from units.compat.mock import mock_open + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + from units.compat.mock import mock_open + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_log_destination.py b/test/units/modules/network/f5/test_bigip_log_destination.py index ee448811c1..dccd540750 100644 --- a/test/units/modules/network/f5/test_bigip_log_destination.py +++ b/test/units/modules/network/f5/test_bigip_log_destination.py @@ -33,24 +33,22 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_log_destination import V1ApiParameters - from ansible.modules.network.f5.bigip_log_destination import V2ApiParameters - from ansible.modules.network.f5.bigip_log_destination import V1ModuleParameters - from ansible.modules.network.f5.bigip_log_destination import V2ModuleParameters - from ansible.modules.network.f5.bigip_log_destination import ModuleManager - from ansible.modules.network.f5.bigip_log_destination import V1Manager - from ansible.modules.network.f5.bigip_log_destination import V2Manager - from ansible.modules.network.f5.bigip_log_destination import ArgumentSpec + from ansible.modules.network.f5.bigip_log_destination import V1ApiParameters + from ansible.modules.network.f5.bigip_log_destination import V2ApiParameters + from ansible.modules.network.f5.bigip_log_destination import V1ModuleParameters + from ansible.modules.network.f5.bigip_log_destination import V2ModuleParameters + from ansible.modules.network.f5.bigip_log_destination import ModuleManager + from ansible.modules.network.f5.bigip_log_destination import V1Manager + from ansible.modules.network.f5.bigip_log_destination import V2Manager + from ansible.modules.network.f5.bigip_log_destination import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_log_publisher.py b/test/units/modules/network/f5/test_bigip_log_publisher.py index 40900ffcc3..725f236e30 100644 --- a/test/units/modules/network/f5/test_bigip_log_publisher.py +++ b/test/units/modules/network/f5/test_bigip_log_publisher.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_log_publisher import ApiParameters - from ansible.modules.network.f5.bigip_log_publisher import ModuleParameters - from ansible.modules.network.f5.bigip_log_publisher import ModuleManager - from ansible.modules.network.f5.bigip_log_publisher import ArgumentSpec + from ansible.modules.network.f5.bigip_log_publisher import ApiParameters + from ansible.modules.network.f5.bigip_log_publisher import ModuleParameters + from ansible.modules.network.f5.bigip_log_publisher import ModuleManager + from ansible.modules.network.f5.bigip_log_publisher import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -96,8 +94,6 @@ class TestParameters(unittest.TestCase): ] -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_management_route.py b/test/units/modules/network/f5/test_bigip_management_route.py index 09d1fb63b3..8317fad327 100644 --- a/test/units/modules/network/f5/test_bigip_management_route.py +++ b/test/units/modules/network/f5/test_bigip_management_route.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_management_route import ApiParameters - from ansible.modules.network.f5.bigip_management_route import ModuleParameters - from ansible.modules.network.f5.bigip_management_route import ModuleManager - from ansible.modules.network.f5.bigip_management_route import ArgumentSpec + from ansible.modules.network.f5.bigip_management_route import ApiParameters + from ansible.modules.network.f5.bigip_management_route import ModuleParameters + from ansible.modules.network.f5.bigip_management_route import ModuleManager + from ansible.modules.network.f5.bigip_management_route import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -91,8 +89,6 @@ class TestParameters(unittest.TestCase): assert p.description == 'configured-by-dhcp' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_node.py b/test/units/modules/network/f5/test_bigip_node.py index fb14f3fc2b..26a6701b82 100644 --- a/test/units/modules/network/f5/test_bigip_node.py +++ b/test/units/modules/network/f5/test_bigip_node.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_node import Parameters - from ansible.modules.network.f5.bigip_node import ModuleParameters - from ansible.modules.network.f5.bigip_node import ApiParameters - from ansible.modules.network.f5.bigip_node import ModuleManager - from ansible.modules.network.f5.bigip_node import ArgumentSpec + from ansible.modules.network.f5.bigip_node import Parameters + from ansible.modules.network.f5.bigip_node import ModuleParameters + from ansible.modules.network.f5.bigip_node import ApiParameters + from ansible.modules.network.f5.bigip_node import ModuleManager + from ansible.modules.network.f5.bigip_node import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_partition.py b/test/units/modules/network/f5/test_bigip_partition.py index c43fd2a715..c5ab561b44 100644 --- a/test/units/modules/network/f5/test_bigip_partition.py +++ b/test/units/modules/network/f5/test_bigip_partition.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_partition import ApiParameters - from ansible.modules.network.f5.bigip_partition import ModuleParameters - from ansible.modules.network.f5.bigip_partition import ModuleManager - from ansible.modules.network.f5.bigip_partition import ArgumentSpec + from ansible.modules.network.f5.bigip_partition import ApiParameters + from ansible.modules.network.f5.bigip_partition import ModuleParameters + from ansible.modules.network.f5.bigip_partition import ModuleManager + from ansible.modules.network.f5.bigip_partition import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_policy.py b/test/units/modules/network/f5/test_bigip_policy.py index 51dd778eaa..41ff9cd672 100644 --- a/test/units/modules/network/f5/test_bigip_policy.py +++ b/test/units/modules/network/f5/test_bigip_policy.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_policy import Parameters - from ansible.modules.network.f5.bigip_policy import ModuleManager - from ansible.modules.network.f5.bigip_policy import SimpleManager - from ansible.modules.network.f5.bigip_policy import ComplexManager - from ansible.modules.network.f5.bigip_policy import ArgumentSpec + from ansible.modules.network.f5.bigip_policy import Parameters + from ansible.modules.network.f5.bigip_policy import ModuleManager + from ansible.modules.network.f5.bigip_policy import SimpleManager + from ansible.modules.network.f5.bigip_policy import ComplexManager + from ansible.modules.network.f5.bigip_policy import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_policy_rule.py b/test/units/modules/network/f5/test_bigip_policy_rule.py index d86261fb86..e31f3047c7 100644 --- a/test/units/modules/network/f5/test_bigip_policy_rule.py +++ b/test/units/modules/network/f5/test_bigip_policy_rule.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_policy_rule import Parameters - from ansible.modules.network.f5.bigip_policy_rule import ModuleParameters - from ansible.modules.network.f5.bigip_policy_rule import ApiParameters - from ansible.modules.network.f5.bigip_policy_rule import ModuleManager - from ansible.modules.network.f5.bigip_policy_rule import ArgumentSpec + from ansible.modules.network.f5.bigip_policy_rule import Parameters + from ansible.modules.network.f5.bigip_policy_rule import ModuleParameters + from ansible.modules.network.f5.bigip_policy_rule import ApiParameters + from ansible.modules.network.f5.bigip_policy_rule import ModuleManager + from ansible.modules.network.f5.bigip_policy_rule import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_pool.py b/test/units/modules/network/f5/test_bigip_pool.py index 09ff05b974..4cab2ad8c1 100644 --- a/test/units/modules/network/f5/test_bigip_pool.py +++ b/test/units/modules/network/f5/test_bigip_pool.py @@ -32,22 +32,20 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_pool import ApiParameters - from ansible.modules.network.f5.bigip_pool import ModuleParameters - from ansible.modules.network.f5.bigip_pool import ModuleManager - from ansible.modules.network.f5.bigip_pool import ArgumentSpec + from ansible.modules.network.f5.bigip_pool import ApiParameters + from ansible.modules.network.f5.bigip_pool import ModuleParameters + from ansible.modules.network.f5.bigip_pool import ModuleManager + from ansible.modules.network.f5.bigip_pool import ArgumentSpec - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_pool_member.py b/test/units/modules/network/f5/test_bigip_pool_member.py index ccc42e8974..9aec965411 100644 --- a/test/units/modules/network/f5/test_bigip_pool_member.py +++ b/test/units/modules/network/f5/test_bigip_pool_member.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_pool_member import ModuleParameters - from ansible.modules.network.f5.bigip_pool_member import ApiParameters - from ansible.modules.network.f5.bigip_pool_member import NodeApiParameters - from ansible.modules.network.f5.bigip_pool_member import ModuleManager - from ansible.modules.network.f5.bigip_pool_member import ArgumentSpec + from ansible.modules.network.f5.bigip_pool_member import ModuleParameters + from ansible.modules.network.f5.bigip_pool_member import ApiParameters + from ansible.modules.network.f5.bigip_pool_member import NodeApiParameters + from ansible.modules.network.f5.bigip_pool_member import ModuleManager + from ansible.modules.network.f5.bigip_pool_member import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_client_ssl.py b/test/units/modules/network/f5/test_bigip_profile_client_ssl.py index d99306a9cb..631f843913 100644 --- a/test/units/modules/network/f5/test_bigip_profile_client_ssl.py +++ b/test/units/modules/network/f5/test_bigip_profile_client_ssl.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_client_ssl import ModuleParameters - from ansible.modules.network.f5.bigip_profile_client_ssl import ApiParameters - from ansible.modules.network.f5.bigip_profile_client_ssl import ModuleManager - from ansible.modules.network.f5.bigip_profile_client_ssl import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_client_ssl import ModuleParameters + from ansible.modules.network.f5.bigip_profile_client_ssl import ApiParameters + from ansible.modules.network.f5.bigip_profile_client_ssl import ModuleManager + from ansible.modules.network.f5.bigip_profile_client_ssl import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_dns.py b/test/units/modules/network/f5/test_bigip_profile_dns.py index 4ca7647ece..9bfa63ad25 100644 --- a/test/units/modules/network/f5/test_bigip_profile_dns.py +++ b/test/units/modules/network/f5/test_bigip_profile_dns.py @@ -30,20 +30,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_dns import ApiParameters - from ansible.modules.network.f5.bigip_profile_dns import ModuleParameters - from ansible.modules.network.f5.bigip_profile_dns import ModuleManager - from ansible.modules.network.f5.bigip_profile_dns import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_dns import ApiParameters + from ansible.modules.network.f5.bigip_profile_dns import ModuleParameters + from ansible.modules.network.f5.bigip_profile_dns import ModuleManager + from ansible.modules.network.f5.bigip_profile_dns import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_fastl4.py b/test/units/modules/network/f5/test_bigip_profile_fastl4.py index 95aa9e1dc1..7accf638b0 100644 --- a/test/units/modules/network/f5/test_bigip_profile_fastl4.py +++ b/test/units/modules/network/f5/test_bigip_profile_fastl4.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_fastl4 import ApiParameters - from ansible.modules.network.f5.bigip_profile_fastl4 import ModuleParameters - from ansible.modules.network.f5.bigip_profile_fastl4 import ModuleManager - from ansible.modules.network.f5.bigip_profile_fastl4 import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_fastl4 import ApiParameters + from ansible.modules.network.f5.bigip_profile_fastl4 import ModuleParameters + from ansible.modules.network.f5.bigip_profile_fastl4 import ModuleManager + from ansible.modules.network.f5.bigip_profile_fastl4 import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_http.py b/test/units/modules/network/f5/test_bigip_profile_http.py index 0a58eba217..fb1acc4376 100644 --- a/test/units/modules/network/f5/test_bigip_profile_http.py +++ b/test/units/modules/network/f5/test_bigip_profile_http.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_http import ApiParameters - from ansible.modules.network.f5.bigip_profile_http import ModuleParameters - from ansible.modules.network.f5.bigip_profile_http import ModuleManager - from ansible.modules.network.f5.bigip_profile_http import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_http import ApiParameters + from ansible.modules.network.f5.bigip_profile_http import ModuleParameters + from ansible.modules.network.f5.bigip_profile_http import ModuleManager + from ansible.modules.network.f5.bigip_profile_http import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_http2.py b/test/units/modules/network/f5/test_bigip_profile_http2.py index fa8f1c14a8..fb82c90a83 100644 --- a/test/units/modules/network/f5/test_bigip_profile_http2.py +++ b/test/units/modules/network/f5/test_bigip_profile_http2.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_http2 import ApiParameters - from ansible.modules.network.f5.bigip_profile_http2 import ModuleParameters - from ansible.modules.network.f5.bigip_profile_http2 import ModuleManager - from ansible.modules.network.f5.bigip_profile_http2 import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_http2 import ApiParameters + from ansible.modules.network.f5.bigip_profile_http2 import ModuleParameters + from ansible.modules.network.f5.bigip_profile_http2 import ModuleManager + from ansible.modules.network.f5.bigip_profile_http2 import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_http_compression.py b/test/units/modules/network/f5/test_bigip_profile_http_compression.py index eb2d59328c..37dccf68d8 100644 --- a/test/units/modules/network/f5/test_bigip_profile_http_compression.py +++ b/test/units/modules/network/f5/test_bigip_profile_http_compression.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_http_compression import ApiParameters - from ansible.modules.network.f5.bigip_profile_http_compression import ModuleParameters - from ansible.modules.network.f5.bigip_profile_http_compression import ModuleManager - from ansible.modules.network.f5.bigip_profile_http_compression import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_http_compression import ApiParameters + from ansible.modules.network.f5.bigip_profile_http_compression import ModuleParameters + from ansible.modules.network.f5.bigip_profile_http_compression import ModuleManager + from ansible.modules.network.f5.bigip_profile_http_compression import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -96,8 +94,6 @@ class TestParameters(unittest.TestCase): assert p.gzip_window_size == 16 -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_profile_oneconnect.py b/test/units/modules/network/f5/test_bigip_profile_oneconnect.py index be51c366c4..965473372a 100644 --- a/test/units/modules/network/f5/test_bigip_profile_oneconnect.py +++ b/test/units/modules/network/f5/test_bigip_profile_oneconnect.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_oneconnect import ApiParameters - from ansible.modules.network.f5.bigip_profile_oneconnect import ModuleParameters - from ansible.modules.network.f5.bigip_profile_oneconnect import ModuleManager - from ansible.modules.network.f5.bigip_profile_oneconnect import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_oneconnect import ApiParameters + from ansible.modules.network.f5.bigip_profile_oneconnect import ModuleParameters + from ansible.modules.network.f5.bigip_profile_oneconnect import ModuleManager + from ansible.modules.network.f5.bigip_profile_oneconnect import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_persistence_cookie.py b/test/units/modules/network/f5/test_bigip_profile_persistence_cookie.py index 95e7b27cd4..abd462f139 100644 --- a/test/units/modules/network/f5/test_bigip_profile_persistence_cookie.py +++ b/test/units/modules/network/f5/test_bigip_profile_persistence_cookie.py @@ -30,20 +30,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_persistence_cookie import ApiParameters - from ansible.modules.network.f5.bigip_profile_persistence_cookie import ModuleParameters - from ansible.modules.network.f5.bigip_profile_persistence_cookie import ModuleManager - from ansible.modules.network.f5.bigip_profile_persistence_cookie import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_persistence_cookie import ApiParameters + from ansible.modules.network.f5.bigip_profile_persistence_cookie import ModuleParameters + from ansible.modules.network.f5.bigip_profile_persistence_cookie import ModuleManager + from ansible.modules.network.f5.bigip_profile_persistence_cookie import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_persistence_src_addr.py b/test/units/modules/network/f5/test_bigip_profile_persistence_src_addr.py index 59213a2624..0983146d8e 100644 --- a/test/units/modules/network/f5/test_bigip_profile_persistence_src_addr.py +++ b/test/units/modules/network/f5/test_bigip_profile_persistence_src_addr.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ApiParameters - from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ModuleParameters - from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ModuleManager - from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ApiParameters + from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ModuleParameters + from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ModuleManager + from ansible.modules.network.f5.bigip_profile_persistence_src_addr import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_server_ssl.py b/test/units/modules/network/f5/test_bigip_profile_server_ssl.py index 4c0cfeee44..3b9a2b4511 100644 --- a/test/units/modules/network/f5/test_bigip_profile_server_ssl.py +++ b/test/units/modules/network/f5/test_bigip_profile_server_ssl.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_server_ssl import ApiParameters - from ansible.modules.network.f5.bigip_profile_server_ssl import ModuleParameters - from ansible.modules.network.f5.bigip_profile_server_ssl import ModuleManager - from ansible.modules.network.f5.bigip_profile_server_ssl import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_server_ssl import ApiParameters + from ansible.modules.network.f5.bigip_profile_server_ssl import ModuleParameters + from ansible.modules.network.f5.bigip_profile_server_ssl import ModuleManager + from ansible.modules.network.f5.bigip_profile_server_ssl import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_tcp.py b/test/units/modules/network/f5/test_bigip_profile_tcp.py index c1fe335d5b..2d0a07af34 100644 --- a/test/units/modules/network/f5/test_bigip_profile_tcp.py +++ b/test/units/modules/network/f5/test_bigip_profile_tcp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_tcp import ApiParameters - from ansible.modules.network.f5.bigip_profile_tcp import ModuleParameters - from ansible.modules.network.f5.bigip_profile_tcp import ModuleManager - from ansible.modules.network.f5.bigip_profile_tcp import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_tcp import ApiParameters + from ansible.modules.network.f5.bigip_profile_tcp import ModuleParameters + from ansible.modules.network.f5.bigip_profile_tcp import ModuleManager + from ansible.modules.network.f5.bigip_profile_tcp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_profile_udp.py b/test/units/modules/network/f5/test_bigip_profile_udp.py index 8c6c46c1a9..ab486bd49b 100644 --- a/test/units/modules/network/f5/test_bigip_profile_udp.py +++ b/test/units/modules/network/f5/test_bigip_profile_udp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_profile_udp import ApiParameters - from ansible.modules.network.f5.bigip_profile_udp import ModuleParameters - from ansible.modules.network.f5.bigip_profile_udp import ModuleManager - from ansible.modules.network.f5.bigip_profile_udp import ArgumentSpec + from ansible.modules.network.f5.bigip_profile_udp import ApiParameters + from ansible.modules.network.f5.bigip_profile_udp import ModuleParameters + from ansible.modules.network.f5.bigip_profile_udp import ModuleManager + from ansible.modules.network.f5.bigip_profile_udp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_provision.py b/test/units/modules/network/f5/test_bigip_provision.py index 6a22b774d0..af75ed533b 100644 --- a/test/units/modules/network/f5/test_bigip_provision.py +++ b/test/units/modules/network/f5/test_bigip_provision.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_provision import Parameters - from ansible.modules.network.f5.bigip_provision import ModuleManager - from ansible.modules.network.f5.bigip_provision import ArgumentSpec + from ansible.modules.network.f5.bigip_provision import Parameters + from ansible.modules.network.f5.bigip_provision import ModuleManager + from ansible.modules.network.f5.bigip_provision import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_qkview.py b/test/units/modules/network/f5/test_bigip_qkview.py index 28cb05e485..49a637840e 100644 --- a/test/units/modules/network/f5/test_bigip_qkview.py +++ b/test/units/modules/network/f5/test_bigip_qkview.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_qkview import Parameters - from ansible.modules.network.f5.bigip_qkview import ModuleManager - from ansible.modules.network.f5.bigip_qkview import MadmLocationManager - from ansible.modules.network.f5.bigip_qkview import BulkLocationManager - from ansible.modules.network.f5.bigip_qkview import ArgumentSpec + from ansible.modules.network.f5.bigip_qkview import Parameters + from ansible.modules.network.f5.bigip_qkview import ModuleManager + from ansible.modules.network.f5.bigip_qkview import MadmLocationManager + from ansible.modules.network.f5.bigip_qkview import BulkLocationManager + from ansible.modules.network.f5.bigip_qkview import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_remote_role.py b/test/units/modules/network/f5/test_bigip_remote_role.py index 5bf5643fb1..97fc134ffa 100644 --- a/test/units/modules/network/f5/test_bigip_remote_role.py +++ b/test/units/modules/network/f5/test_bigip_remote_role.py @@ -8,16 +8,12 @@ __metaclass__ = type import os import json -import pytest import sys from nose.plugins.skip import SkipTest if sys.version_info < (2, 7): raise SkipTest("F5 Ansible modules require Python >= 2.7") -from units.compat import unittest -from units.compat.mock import Mock -from units.compat.mock import patch from ansible.module_utils.basic import AnsibleModule try: @@ -25,20 +21,26 @@ try: from library.modules.bigip_remote_role import ModuleParameters from library.modules.bigip_remote_role import ModuleManager from library.modules.bigip_remote_role import ArgumentSpec - from library.module_utils.network.f5.common import F5ModuleError - from library.module_utils.network.f5.common import iControlUnexpectedHTTPError - from test.unit.modules.utils import set_module_args + + # In Ansible 2.8, Ansible changed import paths. + from test.units.compat import unittest + from test.units.compat.mock import Mock + from test.units.compat.mock import patch + + from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_remote_role import ApiParameters - from ansible.modules.network.f5.bigip_remote_role import ModuleParameters - from ansible.modules.network.f5.bigip_remote_role import ModuleManager - from ansible.modules.network.f5.bigip_remote_role import ArgumentSpec - from ansible.module_utils.network.f5.common import F5ModuleError - from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") + from ansible.modules.network.f5.bigip_remote_role import ApiParameters + from ansible.modules.network.f5.bigip_remote_role import ModuleParameters + from ansible.modules.network.f5.bigip_remote_role import ModuleManager + from ansible.modules.network.f5.bigip_remote_role import ArgumentSpec + + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args + fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_routedomain.py b/test/units/modules/network/f5/test_bigip_routedomain.py index 9f4e99db80..6aab8902f6 100644 --- a/test/units/modules/network/f5/test_bigip_routedomain.py +++ b/test/units/modules/network/f5/test_bigip_routedomain.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_routedomain import ApiParameters - from ansible.modules.network.f5.bigip_routedomain import ModuleParameters - from ansible.modules.network.f5.bigip_routedomain import ModuleManager - from ansible.modules.network.f5.bigip_routedomain import ArgumentSpec + from ansible.modules.network.f5.bigip_routedomain import ApiParameters + from ansible.modules.network.f5.bigip_routedomain import ModuleParameters + from ansible.modules.network.f5.bigip_routedomain import ModuleManager + from ansible.modules.network.f5.bigip_routedomain import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_selfip.py b/test/units/modules/network/f5/test_bigip_selfip.py index d7fe073351..94e558b12e 100644 --- a/test/units/modules/network/f5/test_bigip_selfip.py +++ b/test/units/modules/network/f5/test_bigip_selfip.py @@ -32,22 +32,20 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_selfip import ApiParameters - from ansible.modules.network.f5.bigip_selfip import ModuleParameters - from ansible.modules.network.f5.bigip_selfip import ModuleManager - from ansible.modules.network.f5.bigip_selfip import ArgumentSpec + from ansible.modules.network.f5.bigip_selfip import ApiParameters + from ansible.modules.network.f5.bigip_selfip import ModuleParameters + from ansible.modules.network.f5.bigip_selfip import ModuleManager + from ansible.modules.network.f5.bigip_selfip import ArgumentSpec - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_service_policy.py b/test/units/modules/network/f5/test_bigip_service_policy.py index 848c9dc75b..3e04da0b6c 100644 --- a/test/units/modules/network/f5/test_bigip_service_policy.py +++ b/test/units/modules/network/f5/test_bigip_service_policy.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_service_policy import ApiParameters - from ansible.modules.network.f5.bigip_service_policy import ModuleParameters - from ansible.modules.network.f5.bigip_service_policy import ModuleManager - from ansible.modules.network.f5.bigip_service_policy import ArgumentSpec + from ansible.modules.network.f5.bigip_service_policy import ApiParameters + from ansible.modules.network.f5.bigip_service_policy import ModuleParameters + from ansible.modules.network.f5.bigip_service_policy import ModuleManager + from ansible.modules.network.f5.bigip_service_policy import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -90,8 +88,6 @@ class TestParameters(unittest.TestCase): assert p.port_misuse_policy == '/Common/bar' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_smtp.py b/test/units/modules/network/f5/test_bigip_smtp.py index bf2ce2108e..6a7051177d 100644 --- a/test/units/modules/network/f5/test_bigip_smtp.py +++ b/test/units/modules/network/f5/test_bigip_smtp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_smtp import ApiParameters - from ansible.modules.network.f5.bigip_smtp import ModuleParameters - from ansible.modules.network.f5.bigip_smtp import ModuleManager - from ansible.modules.network.f5.bigip_smtp import ArgumentSpec + from ansible.modules.network.f5.bigip_smtp import ApiParameters + from ansible.modules.network.f5.bigip_smtp import ModuleParameters + from ansible.modules.network.f5.bigip_smtp import ModuleManager + from ansible.modules.network.f5.bigip_smtp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -108,8 +106,6 @@ class TestParameters(unittest.TestCase): assert p.authentication_enabled is True -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_snat_pool.py b/test/units/modules/network/f5/test_bigip_snat_pool.py index 4e64673f12..55df1decd3 100644 --- a/test/units/modules/network/f5/test_bigip_snat_pool.py +++ b/test/units/modules/network/f5/test_bigip_snat_pool.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_snat_pool import ModuleParameters - from ansible.modules.network.f5.bigip_snat_pool import ApiParameters - from ansible.modules.network.f5.bigip_snat_pool import ModuleManager - from ansible.modules.network.f5.bigip_snat_pool import ArgumentSpec + from ansible.modules.network.f5.bigip_snat_pool import ModuleParameters + from ansible.modules.network.f5.bigip_snat_pool import ApiParameters + from ansible.modules.network.f5.bigip_snat_pool import ModuleManager + from ansible.modules.network.f5.bigip_snat_pool import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_snmp.py b/test/units/modules/network/f5/test_bigip_snmp.py index b3e80f62a4..09c306809d 100644 --- a/test/units/modules/network/f5/test_bigip_snmp.py +++ b/test/units/modules/network/f5/test_bigip_snmp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_snmp import ApiParameters - from ansible.modules.network.f5.bigip_snmp import ModuleParameters - from ansible.modules.network.f5.bigip_snmp import ModuleManager - from ansible.modules.network.f5.bigip_snmp import ArgumentSpec + from ansible.modules.network.f5.bigip_snmp import ApiParameters + from ansible.modules.network.f5.bigip_snmp import ModuleParameters + from ansible.modules.network.f5.bigip_snmp import ModuleManager + from ansible.modules.network.f5.bigip_snmp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_snmp_community.py b/test/units/modules/network/f5/test_bigip_snmp_community.py index f8599df1df..2c6aff65a6 100644 --- a/test/units/modules/network/f5/test_bigip_snmp_community.py +++ b/test/units/modules/network/f5/test_bigip_snmp_community.py @@ -34,24 +34,22 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_snmp_community import ApiParameters - from ansible.modules.network.f5.bigip_snmp_community import ModuleParameters - from ansible.modules.network.f5.bigip_snmp_community import ModuleManager - from ansible.modules.network.f5.bigip_snmp_community import V1Manager - from ansible.modules.network.f5.bigip_snmp_community import V2Manager - from ansible.modules.network.f5.bigip_snmp_community import ArgumentSpec + from ansible.modules.network.f5.bigip_snmp_community import ApiParameters + from ansible.modules.network.f5.bigip_snmp_community import ModuleParameters + from ansible.modules.network.f5.bigip_snmp_community import ModuleManager + from ansible.modules.network.f5.bigip_snmp_community import V1Manager + from ansible.modules.network.f5.bigip_snmp_community import V2Manager + from ansible.modules.network.f5.bigip_snmp_community import ArgumentSpec - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -157,8 +155,6 @@ class TestParameters(unittest.TestCase): assert p.snmp_username == 'foo' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_snmp_trap.py b/test/units/modules/network/f5/test_bigip_snmp_trap.py index 0c4775ce3c..274b62eb64 100644 --- a/test/units/modules/network/f5/test_bigip_snmp_trap.py +++ b/test/units/modules/network/f5/test_bigip_snmp_trap.py @@ -32,23 +32,21 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_snmp_trap import V2Parameters - from ansible.modules.network.f5.bigip_snmp_trap import V1Parameters - from ansible.modules.network.f5.bigip_snmp_trap import ModuleManager - from ansible.modules.network.f5.bigip_snmp_trap import V2Manager - from ansible.modules.network.f5.bigip_snmp_trap import V1Manager - from ansible.modules.network.f5.bigip_snmp_trap import ArgumentSpec + from ansible.modules.network.f5.bigip_snmp_trap import V2Parameters + from ansible.modules.network.f5.bigip_snmp_trap import V1Parameters + from ansible.modules.network.f5.bigip_snmp_trap import ModuleManager + from ansible.modules.network.f5.bigip_snmp_trap import V2Manager + from ansible.modules.network.f5.bigip_snmp_trap import V1Manager + from ansible.modules.network.f5.bigip_snmp_trap import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch - from units.compat.mock import DEFAULT + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + from units.compat.mock import DEFAULT + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_software_image.py b/test/units/modules/network/f5/test_bigip_software_image.py index 9f02662421..4e6dd76484 100644 --- a/test/units/modules/network/f5/test_bigip_software_image.py +++ b/test/units/modules/network/f5/test_bigip_software_image.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_software_image import ApiParameters - from ansible.modules.network.f5.bigip_software_image import ModuleParameters - from ansible.modules.network.f5.bigip_software_image import ModuleManager - from ansible.modules.network.f5.bigip_software_image import ArgumentSpec + from ansible.modules.network.f5.bigip_software_image import ApiParameters + from ansible.modules.network.f5.bigip_software_image import ModuleParameters + from ansible.modules.network.f5.bigip_software_image import ModuleManager + from ansible.modules.network.f5.bigip_software_image import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -94,8 +92,6 @@ class TestParameters(unittest.TestCase): assert p.version == '13.1.0.8' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_software_install.py b/test/units/modules/network/f5/test_bigip_software_install.py index e12d738945..f9724582b4 100644 --- a/test/units/modules/network/f5/test_bigip_software_install.py +++ b/test/units/modules/network/f5/test_bigip_software_install.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_software_install import ApiParameters - from ansible.modules.network.f5.bigip_software_install import ModuleParameters - from ansible.modules.network.f5.bigip_software_install import ModuleManager - from ansible.modules.network.f5.bigip_software_install import ArgumentSpec + from ansible.modules.network.f5.bigip_software_install import ApiParameters + from ansible.modules.network.f5.bigip_software_install import ModuleParameters + from ansible.modules.network.f5.bigip_software_install import ModuleManager + from ansible.modules.network.f5.bigip_software_install import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -78,8 +76,6 @@ class TestParameters(unittest.TestCase): assert p.image == 'BIGIP-13.0.0.0.0.1645.iso' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_software_update.py b/test/units/modules/network/f5/test_bigip_software_update.py index 716ccec434..f2ac5922c9 100644 --- a/test/units/modules/network/f5/test_bigip_software_update.py +++ b/test/units/modules/network/f5/test_bigip_software_update.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_software_update import ApiParameters - from ansible.modules.network.f5.bigip_software_update import ModuleParameters - from ansible.modules.network.f5.bigip_software_update import ModuleManager - from ansible.modules.network.f5.bigip_software_update import ArgumentSpec + from ansible.modules.network.f5.bigip_software_update import ApiParameters + from ansible.modules.network.f5.bigip_software_update import ModuleParameters + from ansible.modules.network.f5.bigip_software_update import ModuleManager + from ansible.modules.network.f5.bigip_software_update import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_ssl_certificate.py b/test/units/modules/network/f5/test_bigip_ssl_certificate.py index 48a2a43843..26aa61c195 100644 --- a/test/units/modules/network/f5/test_bigip_ssl_certificate.py +++ b/test/units/modules/network/f5/test_bigip_ssl_certificate.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_ssl_certificate import ArgumentSpec - from ansible.modules.network.f5.bigip_ssl_certificate import ApiParameters - from ansible.modules.network.f5.bigip_ssl_certificate import ModuleParameters - from ansible.modules.network.f5.bigip_ssl_certificate import ModuleManager + from ansible.modules.network.f5.bigip_ssl_certificate import ArgumentSpec + from ansible.modules.network.f5.bigip_ssl_certificate import ApiParameters + from ansible.modules.network.f5.bigip_ssl_certificate import ModuleParameters + from ansible.modules.network.f5.bigip_ssl_certificate import ModuleManager - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_ssl_key.py b/test/units/modules/network/f5/test_bigip_ssl_key.py index b8e79f136c..0858299142 100644 --- a/test/units/modules/network/f5/test_bigip_ssl_key.py +++ b/test/units/modules/network/f5/test_bigip_ssl_key.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_ssl_key import ArgumentSpec - from ansible.modules.network.f5.bigip_ssl_key import ModuleParameters - from ansible.modules.network.f5.bigip_ssl_key import ModuleManager + from ansible.modules.network.f5.bigip_ssl_key import ArgumentSpec + from ansible.modules.network.f5.bigip_ssl_key import ModuleParameters + from ansible.modules.network.f5.bigip_ssl_key import ModuleManager - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_ssl_ocsp.py b/test/units/modules/network/f5/test_bigip_ssl_ocsp.py index cb700be98e..a5502b6994 100644 --- a/test/units/modules/network/f5/test_bigip_ssl_ocsp.py +++ b/test/units/modules/network/f5/test_bigip_ssl_ocsp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_ssl_ocsp import ApiParameters - from ansible.modules.network.f5.bigip_ssl_ocsp import ModuleParameters - from ansible.modules.network.f5.bigip_ssl_ocsp import ModuleManager - from ansible.modules.network.f5.bigip_ssl_ocsp import ArgumentSpec + from ansible.modules.network.f5.bigip_ssl_ocsp import ApiParameters + from ansible.modules.network.f5.bigip_ssl_ocsp import ModuleParameters + from ansible.modules.network.f5.bigip_ssl_ocsp import ModuleManager + from ansible.modules.network.f5.bigip_ssl_ocsp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_static_route.py b/test/units/modules/network/f5/test_bigip_static_route.py index b001170083..c151f7fe81 100644 --- a/test/units/modules/network/f5/test_bigip_static_route.py +++ b/test/units/modules/network/f5/test_bigip_static_route.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_static_route import ApiParameters - from ansible.modules.network.f5.bigip_static_route import ModuleParameters - from ansible.modules.network.f5.bigip_static_route import ModuleManager - from ansible.modules.network.f5.bigip_static_route import ArgumentSpec + from ansible.modules.network.f5.bigip_static_route import ApiParameters + from ansible.modules.network.f5.bigip_static_route import ModuleParameters + from ansible.modules.network.f5.bigip_static_route import ModuleManager + from ansible.modules.network.f5.bigip_static_route import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_sys_daemon_log_tmm.py b/test/units/modules/network/f5/test_bigip_sys_daemon_log_tmm.py index 125f2b4456..19de87242b 100644 --- a/test/units/modules/network/f5/test_bigip_sys_daemon_log_tmm.py +++ b/test/units/modules/network/f5/test_bigip_sys_daemon_log_tmm.py @@ -30,20 +30,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ApiParameters - from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ModuleParameters - from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ModuleManager - from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ArgumentSpec + from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ApiParameters + from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ModuleParameters + from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ModuleManager + from ansible.modules.network.f5.bigip_sys_daemon_log_tmm import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_sys_db.py b/test/units/modules/network/f5/test_bigip_sys_db.py index 91b26ceccf..1b7b6c4c94 100644 --- a/test/units/modules/network/f5/test_bigip_sys_db.py +++ b/test/units/modules/network/f5/test_bigip_sys_db.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_sys_db import Parameters - from ansible.modules.network.f5.bigip_sys_db import ModuleManager - from ansible.modules.network.f5.bigip_sys_db import ArgumentSpec + from ansible.modules.network.f5.bigip_sys_db import Parameters + from ansible.modules.network.f5.bigip_sys_db import ModuleManager + from ansible.modules.network.f5.bigip_sys_db import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_sys_global.py b/test/units/modules/network/f5/test_bigip_sys_global.py index 6c5bc9377f..67ba2bc486 100644 --- a/test/units/modules/network/f5/test_bigip_sys_global.py +++ b/test/units/modules/network/f5/test_bigip_sys_global.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_sys_global import ApiParameters - from ansible.modules.network.f5.bigip_sys_global import ModuleParameters - from ansible.modules.network.f5.bigip_sys_global import ModuleManager - from ansible.modules.network.f5.bigip_sys_global import ArgumentSpec + from ansible.modules.network.f5.bigip_sys_global import ApiParameters + from ansible.modules.network.f5.bigip_sys_global import ModuleParameters + from ansible.modules.network.f5.bigip_sys_global import ModuleManager + from ansible.modules.network.f5.bigip_sys_global import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_timer_policy.py b/test/units/modules/network/f5/test_bigip_timer_policy.py index 5322ee6a7c..c8f9fcb352 100644 --- a/test/units/modules/network/f5/test_bigip_timer_policy.py +++ b/test/units/modules/network/f5/test_bigip_timer_policy.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_timer_policy import ApiParameters - from ansible.modules.network.f5.bigip_timer_policy import ModuleParameters - from ansible.modules.network.f5.bigip_timer_policy import ModuleManager - from ansible.modules.network.f5.bigip_timer_policy import ArgumentSpec + from ansible.modules.network.f5.bigip_timer_policy import ApiParameters + from ansible.modules.network.f5.bigip_timer_policy import ModuleParameters + from ansible.modules.network.f5.bigip_timer_policy import ModuleManager + from ansible.modules.network.f5.bigip_timer_policy import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -85,8 +83,6 @@ class TestParameters(unittest.TestCase): assert p.description == 'my description' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_traffic_group.py b/test/units/modules/network/f5/test_bigip_traffic_group.py index 8b278cb33f..03d9773de7 100644 --- a/test/units/modules/network/f5/test_bigip_traffic_group.py +++ b/test/units/modules/network/f5/test_bigip_traffic_group.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_traffic_group import ApiParameters - from ansible.modules.network.f5.bigip_traffic_group import ModuleParameters - from ansible.modules.network.f5.bigip_traffic_group import ModuleManager - from ansible.modules.network.f5.bigip_traffic_group import ArgumentSpec + from ansible.modules.network.f5.bigip_traffic_group import ApiParameters + from ansible.modules.network.f5.bigip_traffic_group import ModuleParameters + from ansible.modules.network.f5.bigip_traffic_group import ModuleManager + from ansible.modules.network.f5.bigip_traffic_group import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_traffic_selector.py b/test/units/modules/network/f5/test_bigip_traffic_selector.py index 0a217d5529..8c5ddfe2b6 100644 --- a/test/units/modules/network/f5/test_bigip_traffic_selector.py +++ b/test/units/modules/network/f5/test_bigip_traffic_selector.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_traffic_selector import ApiParameters - from ansible.modules.network.f5.bigip_traffic_selector import ModuleParameters - from ansible.modules.network.f5.bigip_traffic_selector import ModuleManager - from ansible.modules.network.f5.bigip_traffic_selector import ArgumentSpec + from ansible.modules.network.f5.bigip_traffic_selector import ApiParameters + from ansible.modules.network.f5.bigip_traffic_selector import ModuleParameters + from ansible.modules.network.f5.bigip_traffic_selector import ModuleManager + from ansible.modules.network.f5.bigip_traffic_selector import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_trunk.py b/test/units/modules/network/f5/test_bigip_trunk.py index f2ebac0531..a6e04c7791 100644 --- a/test/units/modules/network/f5/test_bigip_trunk.py +++ b/test/units/modules/network/f5/test_bigip_trunk.py @@ -30,20 +30,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_trunk import ApiParameters - from ansible.modules.network.f5.bigip_trunk import ModuleParameters - from ansible.modules.network.f5.bigip_trunk import ModuleManager - from ansible.modules.network.f5.bigip_trunk import ArgumentSpec + from ansible.modules.network.f5.bigip_trunk import ApiParameters + from ansible.modules.network.f5.bigip_trunk import ModuleParameters + from ansible.modules.network.f5.bigip_trunk import ModuleManager + from ansible.modules.network.f5.bigip_trunk import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -103,8 +101,6 @@ class TestParameters(unittest.TestCase): assert p.link_selection_policy == 'maximum-bandwidth' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_tunnel.py b/test/units/modules/network/f5/test_bigip_tunnel.py index 7eeefde3f0..b2b120fea5 100644 --- a/test/units/modules/network/f5/test_bigip_tunnel.py +++ b/test/units/modules/network/f5/test_bigip_tunnel.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_tunnel import ApiParameters - from ansible.modules.network.f5.bigip_tunnel import ModuleParameters - from ansible.modules.network.f5.bigip_tunnel import ModuleManager - from ansible.modules.network.f5.bigip_tunnel import ArgumentSpec + from ansible.modules.network.f5.bigip_tunnel import ApiParameters + from ansible.modules.network.f5.bigip_tunnel import ModuleParameters + from ansible.modules.network.f5.bigip_tunnel import ModuleManager + from ansible.modules.network.f5.bigip_tunnel import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -84,8 +82,6 @@ class TestParameters(unittest.TestCase): assert p.name == 'tunnel1' -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigip_ucs.py b/test/units/modules/network/f5/test_bigip_ucs.py index 6c4b5a549c..189d197251 100644 --- a/test/units/modules/network/f5/test_bigip_ucs.py +++ b/test/units/modules/network/f5/test_bigip_ucs.py @@ -33,23 +33,21 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_ucs import ModuleParameters - from ansible.modules.network.f5.bigip_ucs import ModuleManager - from ansible.modules.network.f5.bigip_ucs import ArgumentSpec - from ansible.modules.network.f5.bigip_ucs import V1Manager - from ansible.modules.network.f5.bigip_ucs import V2Manager + from ansible.modules.network.f5.bigip_ucs import ModuleParameters + from ansible.modules.network.f5.bigip_ucs import ModuleManager + from ansible.modules.network.f5.bigip_ucs import ArgumentSpec + from ansible.modules.network.f5.bigip_ucs import V1Manager + from ansible.modules.network.f5.bigip_ucs import V2Manager - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_ucs_fetch.py b/test/units/modules/network/f5/test_bigip_ucs_fetch.py index 15cbe408c5..e9e4bed71b 100644 --- a/test/units/modules/network/f5/test_bigip_ucs_fetch.py +++ b/test/units/modules/network/f5/test_bigip_ucs_fetch.py @@ -30,21 +30,19 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_ucs_fetch import Parameters - from ansible.modules.network.f5.bigip_ucs_fetch import ModuleManager - from ansible.modules.network.f5.bigip_ucs_fetch import V1Manager - from ansible.modules.network.f5.bigip_ucs_fetch import V2Manager - from ansible.modules.network.f5.bigip_ucs_fetch import ArgumentSpec + from ansible.modules.network.f5.bigip_ucs_fetch import Parameters + from ansible.modules.network.f5.bigip_ucs_fetch import ModuleManager + from ansible.modules.network.f5.bigip_ucs_fetch import V1Manager + from ansible.modules.network.f5.bigip_ucs_fetch import V2Manager + from ansible.modules.network.f5.bigip_ucs_fetch import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_user.py b/test/units/modules/network/f5/test_bigip_user.py index 2818d77c06..bba17a7e3f 100644 --- a/test/units/modules/network/f5/test_bigip_user.py +++ b/test/units/modules/network/f5/test_bigip_user.py @@ -33,23 +33,21 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_user import Parameters - from ansible.modules.network.f5.bigip_user import ModuleManager - from ansible.modules.network.f5.bigip_user import ArgumentSpec - from ansible.modules.network.f5.bigip_user import UnpartitionedManager - from ansible.modules.network.f5.bigip_user import PartitionedManager + from ansible.modules.network.f5.bigip_user import Parameters + from ansible.modules.network.f5.bigip_user import ModuleManager + from ansible.modules.network.f5.bigip_user import ArgumentSpec + from ansible.modules.network.f5.bigip_user import UnpartitionedManager + from ansible.modules.network.f5.bigip_user import PartitionedManager - from ansible.module_utils.network.f5.common import F5ModuleError + from ansible.module_utils.network.f5.common import F5ModuleError - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_vcmp_guest.py b/test/units/modules/network/f5/test_bigip_vcmp_guest.py index 3e3cb0a272..062f42fabc 100644 --- a/test/units/modules/network/f5/test_bigip_vcmp_guest.py +++ b/test/units/modules/network/f5/test_bigip_vcmp_guest.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_vcmp_guest import ModuleParameters - from ansible.modules.network.f5.bigip_vcmp_guest import ApiParameters - from ansible.modules.network.f5.bigip_vcmp_guest import ModuleManager - from ansible.modules.network.f5.bigip_vcmp_guest import ArgumentSpec + from ansible.modules.network.f5.bigip_vcmp_guest import ModuleParameters + from ansible.modules.network.f5.bigip_vcmp_guest import ApiParameters + from ansible.modules.network.f5.bigip_vcmp_guest import ModuleManager + from ansible.modules.network.f5.bigip_vcmp_guest import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_virtual_address.py b/test/units/modules/network/f5/test_bigip_virtual_address.py index 42cb845858..a450d6bb89 100644 --- a/test/units/modules/network/f5/test_bigip_virtual_address.py +++ b/test/units/modules/network/f5/test_bigip_virtual_address.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_virtual_address import ApiParameters - from ansible.modules.network.f5.bigip_virtual_address import ModuleParameters - from ansible.modules.network.f5.bigip_virtual_address import ModuleManager - from ansible.modules.network.f5.bigip_virtual_address import ArgumentSpec + from ansible.modules.network.f5.bigip_virtual_address import ApiParameters + from ansible.modules.network.f5.bigip_virtual_address import ModuleParameters + from ansible.modules.network.f5.bigip_virtual_address import ModuleManager + from ansible.modules.network.f5.bigip_virtual_address import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_vlan.py b/test/units/modules/network/f5/test_bigip_vlan.py index 189ce0adc1..43715b2a12 100644 --- a/test/units/modules/network/f5/test_bigip_vlan.py +++ b/test/units/modules/network/f5/test_bigip_vlan.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_vlan import ApiParameters - from ansible.modules.network.f5.bigip_vlan import ModuleParameters - from ansible.modules.network.f5.bigip_vlan import ModuleManager - from ansible.modules.network.f5.bigip_vlan import ArgumentSpec + from ansible.modules.network.f5.bigip_vlan import ApiParameters + from ansible.modules.network.f5.bigip_vlan import ModuleParameters + from ansible.modules.network.f5.bigip_vlan import ModuleManager + from ansible.modules.network.f5.bigip_vlan import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_wait.py b/test/units/modules/network/f5/test_bigip_wait.py index 4315d0920a..398b7b43d9 100644 --- a/test/units/modules/network/f5/test_bigip_wait.py +++ b/test/units/modules/network/f5/test_bigip_wait.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigip_wait import Parameters - from ansible.modules.network.f5.bigip_wait import ModuleManager - from ansible.modules.network.f5.bigip_wait import ArgumentSpec + from ansible.modules.network.f5.bigip_wait import Parameters + from ansible.modules.network.f5.bigip_wait import ModuleManager + from ansible.modules.network.f5.bigip_wait import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigiq_application_fasthttp.py b/test/units/modules/network/f5/test_bigiq_application_fasthttp.py index 5c67e435c9..a3551f28e4 100644 --- a/test/units/modules/network/f5/test_bigiq_application_fasthttp.py +++ b/test/units/modules/network/f5/test_bigiq_application_fasthttp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_application_fasthttp import ApiParameters - from ansible.modules.network.f5.bigiq_application_fasthttp import ModuleParameters - from ansible.modules.network.f5.bigiq_application_fasthttp import ModuleManager - from ansible.modules.network.f5.bigiq_application_fasthttp import ArgumentSpec + from ansible.modules.network.f5.bigiq_application_fasthttp import ApiParameters + from ansible.modules.network.f5.bigiq_application_fasthttp import ModuleParameters + from ansible.modules.network.f5.bigiq_application_fasthttp import ModuleManager + from ansible.modules.network.f5.bigiq_application_fasthttp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -68,35 +66,101 @@ def load_fixture(name): class TestParameters(unittest.TestCase): def test_module_parameters(self): - raise SkipTest('You must write your own module param test. See examples, then remove this exception') - # args = dict( - # monitor_type='m_of_n', - # host='192.168.1.1', - # port=8080 - # ) - # - # p = ModuleParameters(params=args) - # assert p.monitor == 'min 1 of' - # assert p.host == '192.168.1.1' - # assert p.port == 8080 + args = dict( + name='foo', + description='my description', + service_environment='bar', + servers=[ + dict( + address='1.2.3.4', + port=8080 + ), + dict( + address='5.6.7.8', + port=8000 + ) + ], + inbound_virtual=dict( + address='2.2.2.2', + netmask='255.255.255.255', + port=80 + ) + ) - def test_api_parameters(self): - raise SkipTest('You must write your own API param test. See examples, then remove this exception') - # args = dict( - # monitor_type='and_list', - # slowRampTime=200, - # reselectTries=5, - # serviceDownAction='drop' - # ) - # - # p = ApiParameters(params=args) - # assert p.slow_ramp_time == 200 - # assert p.reselect_tries == 5 - # assert p.service_down_action == 'drop' + p = ModuleParameters(params=args) + assert p.name == 'foo' + assert p.config_set_name == 'foo' + assert p.sub_path == 'foo' + assert p.http_profile == 'profile_http' + assert p.service_environment == 'bar' + assert len(p.servers) == 2 + assert 'address' in p.servers[0] + assert 'port' in p.servers[0] + assert 'address' in p.servers[1] + assert 'port' in p.servers[1] + assert p.servers[0]['address'] == '1.2.3.4' + assert p.servers[0]['port'] == 8080 + assert p.servers[1]['address'] == '5.6.7.8' + assert p.servers[1]['port'] == 8000 + assert 'address' in p.inbound_virtual + assert 'netmask' in p.inbound_virtual + assert 'port' in p.inbound_virtual + assert p.inbound_virtual['address'] == '2.2.2.2' + assert p.inbound_virtual['netmask'] == '255.255.255.255' + assert p.inbound_virtual['port'] == 80 -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): + + def setUp(self): + self.spec = ArgumentSpec() + self.patcher1 = patch('time.sleep') + self.patcher1.start() + + def tearDown(self): + self.patcher1.stop() + def test_create(self, *args): - raise SkipTest('You must write a creation test') + set_module_args(dict( + name='foo', + description='my description', + service_environment='bar', + servers=[ + dict( + address='1.2.3.4', + port=8080 + ), + dict( + address='5.6.7.8', + port=8000 + ) + ], + inbound_virtual=dict( + address='2.2.2.2', + netmask='255.255.255.255', + port=80 + ), + provider=dict( + server='localhost', + password='password', + user='admin' + ) + )) + + module = AnsibleModule( + argument_spec=self.spec.argument_spec, + supports_check_mode=self.spec.supports_check_mode + ) + + # Override methods to force specific logic in the module to happen + mm = ModuleManager(module=module) + mm.has_no_service_environment = Mock(return_value=False) + mm.wait_for_apply_template_task = Mock(return_value=True) + + mm.create_on_device = Mock(return_value=True) + mm.exists = Mock(side_effect=[False, True]) + + results = mm.exec_module() + + assert results['changed'] is True + assert results['description'] == 'my description' diff --git a/test/units/modules/network/f5/test_bigiq_application_fastl4_tcp.py b/test/units/modules/network/f5/test_bigiq_application_fastl4_tcp.py index d34db62f6a..6db316dfe8 100644 --- a/test/units/modules/network/f5/test_bigiq_application_fastl4_tcp.py +++ b/test/units/modules/network/f5/test_bigiq_application_fastl4_tcp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ApiParameters - from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ModuleParameters - from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ModuleManager - from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ArgumentSpec + from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ApiParameters + from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ModuleParameters + from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ModuleManager + from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -112,8 +110,6 @@ class TestParameters(unittest.TestCase): assert p.inbound_virtual['port'] == 80 -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigiq_application_fastl4_udp.py b/test/units/modules/network/f5/test_bigiq_application_fastl4_udp.py index ab5b478799..69cade7782 100644 --- a/test/units/modules/network/f5/test_bigiq_application_fastl4_udp.py +++ b/test/units/modules/network/f5/test_bigiq_application_fastl4_udp.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_application_fastl4_udp import ApiParameters - from ansible.modules.network.f5.bigiq_application_fastl4_udp import ModuleParameters - from ansible.modules.network.f5.bigiq_application_fastl4_udp import ModuleManager - from ansible.modules.network.f5.bigiq_application_fastl4_udp import ArgumentSpec + from ansible.modules.network.f5.bigiq_application_fastl4_udp import ApiParameters + from ansible.modules.network.f5.bigiq_application_fastl4_udp import ModuleParameters + from ansible.modules.network.f5.bigiq_application_fastl4_udp import ModuleManager + from ansible.modules.network.f5.bigiq_application_fastl4_udp import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -112,8 +110,6 @@ class TestParameters(unittest.TestCase): assert p.inbound_virtual['port'] == 80 -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigiq_application_http.py b/test/units/modules/network/f5/test_bigiq_application_http.py index 4ee62753cf..aa79587db4 100644 --- a/test/units/modules/network/f5/test_bigiq_application_http.py +++ b/test/units/modules/network/f5/test_bigiq_application_http.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_application_http import ApiParameters - from ansible.modules.network.f5.bigiq_application_http import ModuleParameters - from ansible.modules.network.f5.bigiq_application_http import ModuleManager - from ansible.modules.network.f5.bigiq_application_http import ArgumentSpec + from ansible.modules.network.f5.bigiq_application_http import ApiParameters + from ansible.modules.network.f5.bigiq_application_http import ModuleParameters + from ansible.modules.network.f5.bigiq_application_http import ModuleManager + from ansible.modules.network.f5.bigiq_application_http import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -112,8 +110,6 @@ class TestParameters(unittest.TestCase): assert p.inbound_virtual['port'] == 80 -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigiq_application_https_offload.py b/test/units/modules/network/f5/test_bigiq_application_https_offload.py index d55fbc44f9..61f2be15bc 100644 --- a/test/units/modules/network/f5/test_bigiq_application_https_offload.py +++ b/test/units/modules/network/f5/test_bigiq_application_https_offload.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_application_https_offload import ApiParameters - from ansible.modules.network.f5.bigiq_application_https_offload import ModuleParameters - from ansible.modules.network.f5.bigiq_application_https_offload import ModuleManager - from ansible.modules.network.f5.bigiq_application_https_offload import ArgumentSpec + from ansible.modules.network.f5.bigiq_application_https_offload import ApiParameters + from ansible.modules.network.f5.bigiq_application_https_offload import ModuleParameters + from ansible.modules.network.f5.bigiq_application_https_offload import ModuleManager + from ansible.modules.network.f5.bigiq_application_https_offload import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -123,8 +121,6 @@ class TestParameters(unittest.TestCase): assert p.redirect_virtual['port'] == 80 -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigiq_application_https_waf.py b/test/units/modules/network/f5/test_bigiq_application_https_waf.py index 3810d59559..e1f1addb57 100644 --- a/test/units/modules/network/f5/test_bigiq_application_https_waf.py +++ b/test/units/modules/network/f5/test_bigiq_application_https_waf.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_application_https_waf import ApiParameters - from ansible.modules.network.f5.bigiq_application_https_waf import ModuleParameters - from ansible.modules.network.f5.bigiq_application_https_waf import ModuleManager - from ansible.modules.network.f5.bigiq_application_https_waf import ArgumentSpec + from ansible.modules.network.f5.bigiq_application_https_waf import ApiParameters + from ansible.modules.network.f5.bigiq_application_https_waf import ModuleParameters + from ansible.modules.network.f5.bigiq_application_https_waf import ModuleManager + from ansible.modules.network.f5.bigiq_application_https_waf import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} @@ -127,8 +125,6 @@ class TestParameters(unittest.TestCase): assert p.redirect_virtual['port'] == 80 -@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root', - return_value=True) class TestManager(unittest.TestCase): def setUp(self): diff --git a/test/units/modules/network/f5/test_bigiq_device_facts.py b/test/units/modules/network/f5/test_bigiq_device_facts.py index ba93c98fb4..841d83cfc1 100644 --- a/test/units/modules/network/f5/test_bigiq_device_facts.py +++ b/test/units/modules/network/f5/test_bigiq_device_facts.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_device_facts import Parameters - from ansible.modules.network.f5.bigiq_device_facts import SystemInfoFactManager - from ansible.modules.network.f5.bigiq_device_facts import ModuleManager - from ansible.modules.network.f5.bigiq_device_facts import ArgumentSpec + from ansible.modules.network.f5.bigiq_device_facts import Parameters + from ansible.modules.network.f5.bigiq_device_facts import SystemInfoFactManager + from ansible.modules.network.f5.bigiq_device_facts import ModuleManager + from ansible.modules.network.f5.bigiq_device_facts import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigiq_regkey_license.py b/test/units/modules/network/f5/test_bigiq_regkey_license.py index 80d2b5e705..2739f19f08 100644 --- a/test/units/modules/network/f5/test_bigiq_regkey_license.py +++ b/test/units/modules/network/f5/test_bigiq_regkey_license.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_regkey_license import ModuleParameters - from ansible.modules.network.f5.bigiq_regkey_license import ApiParameters - from ansible.modules.network.f5.bigiq_regkey_license import ModuleManager - from ansible.modules.network.f5.bigiq_regkey_license import ArgumentSpec + from ansible.modules.network.f5.bigiq_regkey_license import ModuleParameters + from ansible.modules.network.f5.bigiq_regkey_license import ApiParameters + from ansible.modules.network.f5.bigiq_regkey_license import ModuleManager + from ansible.modules.network.f5.bigiq_regkey_license import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigiq_regkey_license_assignment.py b/test/units/modules/network/f5/test_bigiq_regkey_license_assignment.py index cd623c8c28..d61fb2e0b9 100644 --- a/test/units/modules/network/f5/test_bigiq_regkey_license_assignment.py +++ b/test/units/modules/network/f5/test_bigiq_regkey_license_assignment.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_regkey_license_assignment import ApiParameters - from ansible.modules.network.f5.bigiq_regkey_license_assignment import ModuleParameters - from ansible.modules.network.f5.bigiq_regkey_license_assignment import ModuleManager - from ansible.modules.network.f5.bigiq_regkey_license_assignment import ArgumentSpec + from ansible.modules.network.f5.bigiq_regkey_license_assignment import ApiParameters + from ansible.modules.network.f5.bigiq_regkey_license_assignment import ModuleParameters + from ansible.modules.network.f5.bigiq_regkey_license_assignment import ModuleManager + from ansible.modules.network.f5.bigiq_regkey_license_assignment import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigiq_regkey_pool.py b/test/units/modules/network/f5/test_bigiq_regkey_pool.py index ec4f33da02..d2da5b8035 100644 --- a/test/units/modules/network/f5/test_bigiq_regkey_pool.py +++ b/test/units/modules/network/f5/test_bigiq_regkey_pool.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_regkey_pool import ModuleParameters - from ansible.modules.network.f5.bigiq_regkey_pool import ApiParameters - from ansible.modules.network.f5.bigiq_regkey_pool import ModuleManager - from ansible.modules.network.f5.bigiq_regkey_pool import ArgumentSpec + from ansible.modules.network.f5.bigiq_regkey_pool import ModuleParameters + from ansible.modules.network.f5.bigiq_regkey_pool import ApiParameters + from ansible.modules.network.f5.bigiq_regkey_pool import ModuleManager + from ansible.modules.network.f5.bigiq_regkey_pool import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigiq_utility_license.py b/test/units/modules/network/f5/test_bigiq_utility_license.py index c07351c592..4a2a9c3b87 100644 --- a/test/units/modules/network/f5/test_bigiq_utility_license.py +++ b/test/units/modules/network/f5/test_bigiq_utility_license.py @@ -28,19 +28,17 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_utility_license import ModuleParameters - from ansible.modules.network.f5.bigiq_utility_license import ModuleManager - from ansible.modules.network.f5.bigiq_utility_license import ArgumentSpec + from ansible.modules.network.f5.bigiq_utility_license import ModuleParameters + from ansible.modules.network.f5.bigiq_utility_license import ModuleManager + from ansible.modules.network.f5.bigiq_utility_license import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigiq_utility_license_assignment.py b/test/units/modules/network/f5/test_bigiq_utility_license_assignment.py index 05bc35782a..19dd42892c 100644 --- a/test/units/modules/network/f5/test_bigiq_utility_license_assignment.py +++ b/test/units/modules/network/f5/test_bigiq_utility_license_assignment.py @@ -29,20 +29,18 @@ try: from test.units.modules.utils import set_module_args except ImportError: - try: - from ansible.modules.network.f5.bigiq_utility_license_assignment import ApiParameters - from ansible.modules.network.f5.bigiq_utility_license_assignment import ModuleParameters - from ansible.modules.network.f5.bigiq_utility_license_assignment import ModuleManager - from ansible.modules.network.f5.bigiq_utility_license_assignment import ArgumentSpec + from ansible.modules.network.f5.bigiq_utility_license_assignment import ApiParameters + from ansible.modules.network.f5.bigiq_utility_license_assignment import ModuleParameters + from ansible.modules.network.f5.bigiq_utility_license_assignment import ModuleManager + from ansible.modules.network.f5.bigiq_utility_license_assignment import ArgumentSpec - # Ansible 2.8 imports - from units.compat import unittest - from units.compat.mock import Mock - from units.compat.mock import patch + # Ansible 2.8 imports + from units.compat import unittest + from units.compat.mock import Mock + from units.compat.mock import patch + + from units.modules.utils import set_module_args - from units.modules.utils import set_module_args - except ImportError: - raise SkipTest("F5 Ansible modules require the f5-sdk Python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {}