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")
|
raise SkipTest("F5 Ansible modules require Python >= 2.7")
|
||||||
|
|
||||||
from ansible.compat.tests import unittest
|
from ansible.compat.tests import unittest
|
||||||
from ansible.compat.tests.mock import patch, Mock
|
from ansible.compat.tests.mock import Mock
|
||||||
|
from ansible.compat.tests.mock import patch
|
||||||
from ansible.module_utils.f5_utils import AnsibleF5Client
|
from ansible.module_utils.f5_utils import AnsibleF5Client
|
||||||
from units.modules.utils import set_module_args
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from library.bigip_config import Parameters
|
from library.bigip_config import Parameters
|
||||||
from library.bigip_config import ModuleManager
|
from library.bigip_config import ModuleManager
|
||||||
from library.bigip_config import ArgumentSpec
|
from library.bigip_config import ArgumentSpec
|
||||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
|
from test.unit.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from ansible.modules.network.f5.bigip_config import Parameters
|
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 ModuleManager
|
||||||
from ansible.modules.network.f5.bigip_config import ArgumentSpec
|
from ansible.modules.network.f5.bigip_config import ArgumentSpec
|
||||||
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
from ansible.module_utils.f5_utils import iControlUnexpectedHTTPError
|
||||||
|
from units.modules.utils import set_module_args
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
|
||||||
|
|
||||||
|
@ -39,12 +41,19 @@ fixture_data = {}
|
||||||
|
|
||||||
def load_fixture(name):
|
def load_fixture(name):
|
||||||
path = os.path.join(fixture_path, name)
|
path = os.path.join(fixture_path, name)
|
||||||
|
|
||||||
|
if path in fixture_data:
|
||||||
|
return fixture_data[path]
|
||||||
|
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
fixture_data[path] = data
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue