Fixes unit tests and move client variable (#48494)

pull/48499/head
Tim Rupp 6 years ago committed by GitHub
parent 7d11e6e3e5
commit 3132ce8404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -521,8 +521,9 @@ def main():
supports_check_mode=spec.supports_check_mode,
)
client = F5RestClient(**module.params)
try:
client = F5RestClient(**module.params)
mm = ModuleManager(module=module, client=client)
results = mm.exec_module()
cleanup_tokens(client)

@ -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,17 +21,25 @@ try:
from library.modules.bigip_firewall_rule_list import ApiParameters
from library.modules.bigip_firewall_rule_list import ModuleManager
from library.modules.bigip_firewall_rule_list 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_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.module_utils.network.f5.common import F5ModuleError
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
# 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")

Loading…
Cancel
Save