mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-27 03:19:09 -07:00
Refactors and deprecation removals (#34830)
This patch is primarily a refactor to make the validate-modules arg-spec no longer generate a traceback. It additionally includes removal of deprecated code in the virtual server module.
This commit is contained in:
parent
a10aee0fc3
commit
c548ab0f18
26 changed files with 1612 additions and 2099 deletions
|
@ -18,23 +18,22 @@ if sys.version_info < (2, 7):
|
|||
from ansible.compat.tests import unittest
|
||||
from ansible.compat.tests.mock import Mock
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.module_utils.f5_utils import AnsibleF5Client
|
||||
from ansible.module_utils.f5_utils import F5ModuleError
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
from library.bigip_wait import Parameters
|
||||
from library.bigip_wait import ModuleManager
|
||||
from library.bigip_wait import ArgumentSpec
|
||||
from library.bigip_wait import AnsibleF5ClientStub
|
||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||
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
|
||||
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 AnsibleF5ClientStub
|
||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||
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")
|
||||
|
@ -70,7 +69,7 @@ class TestParameters(unittest.TestCase):
|
|||
msg='We timed out during waiting for BIG-IP :-('
|
||||
)
|
||||
|
||||
p = Parameters(args)
|
||||
p = Parameters(params=args)
|
||||
assert p.delay == 3
|
||||
assert p.timeout == 500
|
||||
assert p.sleep == 10
|
||||
|
@ -84,15 +83,13 @@ class TestParameters(unittest.TestCase):
|
|||
msg='We timed out during waiting for BIG-IP :-('
|
||||
)
|
||||
|
||||
p = Parameters(args)
|
||||
p = Parameters(params=args)
|
||||
assert p.delay == 3
|
||||
assert p.timeout == 500
|
||||
assert p.sleep == 10
|
||||
assert p.msg == 'We timed out during waiting for BIG-IP :-('
|
||||
|
||||
|
||||
@patch('ansible.module_utils.f5_utils.AnsibleF5Client._get_mgmt_root',
|
||||
return_value=True)
|
||||
class TestManager(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.spec = ArgumentSpec()
|
||||
|
@ -104,14 +101,13 @@ class TestManager(unittest.TestCase):
|
|||
user='admin'
|
||||
))
|
||||
|
||||
client = AnsibleF5ClientStub(
|
||||
module = AnsibleModule(
|
||||
argument_spec=self.spec.argument_spec,
|
||||
supports_check_mode=self.spec.supports_check_mode,
|
||||
f5_product_name=self.spec.f5_product_name
|
||||
supports_check_mode=self.spec.supports_check_mode
|
||||
)
|
||||
|
||||
# Override methods to force specific logic in the module to happen
|
||||
mm = ModuleManager(client)
|
||||
mm = ModuleManager(module=module)
|
||||
mm._connect_to_device = Mock(return_value=True)
|
||||
mm._device_is_rebooting = Mock(return_value=False)
|
||||
mm._is_mprov_running_on_device = Mock(return_value=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue