mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adds various fixes for bigip_config tests (#33470)
There were upstream changes that were incompatible with the downstream code. This fixes those.
This commit is contained in:
parent
9225052496
commit
f6be12b5d8
1 changed files with 11 additions and 2 deletions
|
@ -15,21 +15,23 @@ if sys.version_info < (2, 7):
|
|||
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
||||
|
||||
from ansible.compat.tests import unittest
|
||||
from ansible.compat.tests.mock import patch, Mock
|
||||
from ansible.compat.tests.mock import Mock
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.module_utils.f5_utils import AnsibleF5Client
|
||||
from units.modules.utils import set_module_args
|
||||
|
||||
try:
|
||||
from library.bigip_config import Parameters
|
||||
from library.bigip_config import ModuleManager
|
||||
from library.bigip_config import ArgumentSpec
|
||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||
from test.unit.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.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||
from units.modules.utils import set_module_args
|
||||
except ImportError:
|
||||
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
||||
|
||||
|
@ -39,12 +41,19 @@ fixture_data = {}
|
|||
|
||||
def load_fixture(name):
|
||||
path = os.path.join(fixture_path, name)
|
||||
|
||||
if path in fixture_data:
|
||||
return fixture_data[path]
|
||||
|
||||
with open(path) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
data = json.loads(data)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
fixture_data[path] = data
|
||||
return data
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue