Makes all unit tests look the same (#25762)

Just a little cleanup from an earlier patch that makes f5 unit
tests only run if the f5 sdk is installed
This commit is contained in:
Tim Rupp 2017-06-16 02:36:53 -07:00 committed by John R Barker
parent 41f6f8f410
commit c51b73d800
12 changed files with 173 additions and 207 deletions

View file

@ -20,14 +20,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
import sys
from nose.plugins.skip import SkipTest
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
@ -45,11 +44,10 @@ except ImportError:
from ansible.modules.network.f5.bigip_command import ModuleManager
from ansible.modules.network.f5.bigip_command import ArgumentSpec
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("%s requires the python modules for f5/bigip" % __file__)
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def set_module_args(args):

View file

@ -20,14 +20,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
import sys
from nose.plugins.skip import SkipTest
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
@ -45,10 +44,10 @@ except ImportError:
from ansible.modules.network.f5.bigip_config import ModuleManager
from ansible.modules.network.f5.bigip_config import ArgumentSpec
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("%s requires the python modules for f5/bigip" % __file__)
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def set_module_args(args):

View file

@ -20,14 +20,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
import sys
from nose.plugins.skip import SkipTest
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
@ -49,9 +48,7 @@ except ImportError:
from ansible.modules.network.f5.bigip_gtm_pool import UntypedManager
from ansible.modules.network.f5.bigip_gtm_pool import TypedManager
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("%s requires the python modules for f5/bigip" % __file__)
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}

View file

@ -20,15 +20,14 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
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 ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock
@ -44,11 +43,14 @@ try:
from library.bigip_gtm_wide_ip import UntypedManager
from library.bigip_gtm_wide_ip import TypedManager
except ImportError:
try:
from ansible.modules.network.f5.bigip_gtm_wide_ip import Parameters
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
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 = {}

View file

@ -20,14 +20,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest
from ansible.module_utils import basic
@ -40,9 +39,12 @@ try:
from library.bigip_iapp_template import ModuleManager
from library.bigip_iapp_template import ArgumentSpec
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
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 = {}

View file

@ -20,14 +20,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
import sys
from nose.plugins.skip import SkipTest
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_open, Mock
@ -43,11 +42,14 @@ try:
from library.bigip_irule import GtmManager
from library.bigip_irule import LtmManager
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
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 = {}

View file

@ -20,15 +20,14 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
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 ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock
@ -47,9 +46,7 @@ except ImportError:
from ansible.modules.network.f5.bigip_pool import ModuleManager
from ansible.modules.network.f5.bigip_pool import ArgumentSpec
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("%s requires the python modules for f5/bigip" % __file__)
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}

View file

@ -20,14 +20,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
import sys
from nose.plugins.skip import SkipTest
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
@ -40,9 +39,12 @@ try:
from library.bigip_provision import ModuleManager
from library.bigip_provision import ArgumentSpec
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
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 = {}

View file

@ -20,16 +20,14 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock
from ansible.module_utils import basic
@ -46,7 +44,7 @@ except ImportError:
from ansible.modules.network.f5.bigip_snmp import ModuleManager
from ansible.modules.network.f5.bigip_snmp import ArgumentSpec
except ImportError:
raise SkipTest("F5 Ansible modules the f5 python library")
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}

View file

@ -20,14 +20,13 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
import sys
from nose.plugins.skip import SkipTest
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, DEFAULT, Mock
@ -51,9 +50,7 @@ except ImportError:
from ansible.modules.network.f5.bigip_snmp_trap import NonNetworkedManager
from ansible.modules.network.f5.bigip_snmp_trap import ArgumentSpec
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("%s requires the python modules for f5/bigip" % __file__)
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}

View file

@ -20,19 +20,17 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import pytest
if sys.version_info < (2, 7):
from nose.plugins.skip import SkipTest
raise SkipTest("F5 Ansible modules require Python >= 2.7")
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 ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch
from ansible.compat.tests.mock import patch, Mock
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
from ansible.module_utils.f5_utils import AnsibleF5Client
@ -52,9 +50,7 @@ except ImportError:
from ansible.modules.network.f5.bigip_user import UnparitionedManager
from ansible.modules.network.f5.bigip_user import PartitionedManager
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("%s requires the python modules for f5/bigip" % __file__)
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
@ -146,12 +142,11 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.create_on_device = lambda: True
pm.exists = lambda: False
pm.create_on_device = Mock(return_value=True)
pm.exists = Mock(return_value=False)
results = pm.exec_module()
@ -176,12 +171,11 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.create_on_device = lambda: True
pm.exists = lambda: False
pm.create_on_device = Mock(return_value=True)
pm.exists = Mock(return_value=False)
results = pm.exec_module()
@ -207,12 +201,11 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.create_on_device = lambda: True
pm.exists = lambda: False
pm.create_on_device = Mock(return_value=True)
pm.exists = Mock(return_value=False)
msg = "The 'update_password' option " \
"needs to be set to 'on_create' when creating " \
@ -238,12 +231,11 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.create_on_device = lambda: True
pm.exists = lambda: False
pm.create_on_device = Mock(return_value=True)
pm.exists = Mock(return_value=False)
msg = "The 'partition_access' option " \
"is required when creating a resource."
@ -273,12 +265,11 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.create_on_device = lambda: True
pm.exists = lambda: False
pm.create_on_device = Mock(return_value=True)
pm.exists = Mock(return_value=False)
results = pm.exec_module()
@ -306,12 +297,11 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.create_on_device = lambda: True
pm.exists = lambda: False
pm.create_on_device = Mock(return_value=True)
pm.exists = Mock(return_value=False)
msg = "Shell access is only available to 'admin' or " \
"'resource-admin' roles"
@ -341,13 +331,12 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.exists = lambda: True
pm.update_on_device = lambda: True
pm.read_current_from_device = lambda: current
pm.exists = Mock(return_value=True)
pm.update_on_device = Mock(return_value=True)
pm.read_current_from_device = Mock(return_value=current)
results = pm.exec_module()
@ -374,13 +363,12 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.exists = lambda: True
pm.update_on_device = lambda: True
pm.read_current_from_device = lambda: current
pm.exists = Mock(return_value=True)
pm.update_on_device = Mock(return_value=True)
pm.read_current_from_device = Mock(return_value=current)
results = pm.exec_module()
@ -412,13 +400,12 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.exists = lambda: True
pm.update_on_device = lambda: True
pm.read_current_from_device = lambda: current
pm.exists = Mock(return_value=True)
pm.update_on_device = Mock(return_value=True)
pm.read_current_from_device = Mock(return_value=current)
results = pm.exec_module()
@ -452,13 +439,12 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: False
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=False)
pm = PartitionedManager(client)
pm.exists = lambda: True
pm.update_on_device = lambda: True
pm.read_current_from_device = lambda: current
pm.exists = Mock(return_value=True)
pm.update_on_device = Mock(return_value=True)
pm.read_current_from_device = Mock(return_value=current)
results = pm.exec_module()
@ -493,13 +479,12 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.exists = lambda: True
upm.update_on_device = lambda: True
upm.read_current_from_device = lambda: current
upm.exists = Mock(return_value=True)
upm.update_on_device = Mock(return_value=True)
upm.read_current_from_device = Mock(return_value=current)
results = upm.exec_module()
@ -537,13 +522,12 @@ class TestManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.exists = lambda: True
upm.update_on_device = lambda: True
upm.read_current_from_device = lambda: current
upm.exists = Mock(return_value=True)
upm.update_on_device = Mock(return_value=True)
upm.read_current_from_device = Mock(return_value=current)
msg = "Shell access is only available to 'admin' or " \
"'resource-admin' roles"
@ -580,12 +564,11 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.create_on_device = lambda: True
upm.exists = lambda: False
upm.create_on_device = Mock(return_value=True)
upm.exists = Mock(return_value=False)
results = upm.exec_module()
@ -610,12 +593,11 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.create_on_device = lambda: True
upm.exists = lambda: False
upm.create_on_device = Mock(return_value=True)
upm.exists = Mock(return_value=False)
results = upm.exec_module()
@ -641,12 +623,11 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.create_on_device = lambda: True
upm.exists = lambda: False
upm.create_on_device = Mock(return_value=True)
upm.exists = Mock(return_value=False)
msg = "The 'update_password' option " \
"needs to be set to 'on_create' when creating " \
@ -672,12 +653,11 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.create_on_device = lambda: True
upm.exists = lambda: False
upm.create_on_device = Mock(return_value=True)
upm.exists = Mock(return_value=False)
msg = "The 'partition_access' option " \
"is required when creating a resource."
@ -707,12 +687,11 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.create_on_device = lambda: True
upm.exists = lambda: False
upm.create_on_device = Mock(return_value=True)
upm.exists = Mock(return_value=False)
results = upm.exec_module()
@ -740,12 +719,11 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.create_on_device = lambda: True
upm.exists = lambda: False
upm.create_on_device = Mock(return_value=True)
upm.exists = Mock(return_value=False)
msg = "Shell access is only available to 'admin' or " \
"'resource-admin' roles"
@ -781,13 +759,12 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.exists = lambda: True
upm.update_on_device = lambda: True
upm.read_current_from_device = lambda: current
upm.exists = Mock(return_value=True)
upm.update_on_device = Mock(return_value=True)
upm.read_current_from_device = Mock(return_value=current)
results = upm.exec_module()
@ -819,13 +796,12 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.exists = lambda: True
upm.update_on_device = lambda: True
upm.read_current_from_device = lambda: current
upm.exists = Mock(return_value=True)
upm.update_on_device = Mock(return_value=True)
upm.read_current_from_device = Mock(return_value=current)
results = upm.exec_module()
@ -859,13 +835,12 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.exists = lambda: True
upm.update_on_device = lambda: True
upm.read_current_from_device = lambda: current
upm.exists = Mock(return_value=True)
upm.update_on_device = Mock(return_value=True)
upm.read_current_from_device = Mock(return_value=current)
results = upm.exec_module()
@ -900,13 +875,12 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.exists = lambda: True
upm.update_on_device = lambda: True
upm.read_current_from_device = lambda: current
upm.exists = Mock(return_value=True)
upm.update_on_device = Mock(return_value=True)
upm.read_current_from_device = Mock(return_value=current)
results = upm.exec_module()
@ -944,13 +918,12 @@ class TestLegacyManager(unittest.TestCase):
# Override methods to force specific logic in the module to happen
mm = ModuleManager(client)
mm.is_version_less_than_13 = lambda: True
mm.exit_json = lambda x: False
mm.is_version_less_than_13 = Mock(return_value=True)
upm = UnparitionedManager(client)
upm.exists = lambda: True
upm.update_on_device = lambda: True
upm.read_current_from_device = lambda: current
upm.exists = Mock(return_value=True)
upm.update_on_device = Mock(return_value=True)
upm.read_current_from_device = Mock(return_value=current)
msg = "Shell access is only available to 'admin' or " \
"'resource-admin' roles"

View file

@ -20,15 +20,14 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
import os
import json
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, Mock
from ansible.module_utils import basic
@ -45,7 +44,7 @@ except ImportError:
from ansible.modules.network.f5.bigip_virtual_address import ModuleManager
from ansible.modules.network.f5.bigip_virtual_address import ArgumentSpec
except ImportError:
raise SkipTest("This test requries F5 python libraries")
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}