1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix more includes.

This commit is contained in:
Felix Fontein 2020-03-22 22:09:21 +01:00
parent 8740d8d185
commit a01b831bd3
6 changed files with 18 additions and 14 deletions

View file

@ -28,10 +28,10 @@ try:
from test.unit.modules.utils import set_module_args from test.unit.modules.utils import set_module_args
except ImportError: except ImportError:
try: try:
from ansible.modules.network.f5.bigip_security_address_list import ApiParameters from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_address_list import ApiParameters
from ansible.modules.network.f5.bigip_security_address_list import ModuleParameters from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_address_list import ModuleParameters
from ansible.modules.network.f5.bigip_security_address_list import ModuleManager from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_address_list import ModuleManager
from ansible.modules.network.f5.bigip_security_address_list import ArgumentSpec from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_address_list import ArgumentSpec
from ansible_collections.community.general.tests.unit.modules.utils import set_module_args from ansible_collections.community.general.tests.unit.modules.utils import set_module_args
except ImportError: except ImportError:
pytestmark.append(pytest.mark.skip("F5 Ansible modules require the f5-sdk Python library")) pytestmark.append(pytest.mark.skip("F5 Ansible modules require the f5-sdk Python library"))

View file

@ -28,10 +28,10 @@ try:
from test.unit.modules.utils import set_module_args from test.unit.modules.utils import set_module_args
except ImportError: except ImportError:
try: try:
from ansible.modules.network.f5.bigip_security_port_list import ApiParameters from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_port_list import ApiParameters
from ansible.modules.network.f5.bigip_security_port_list import ModuleParameters from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_port_list import ModuleParameters
from ansible.modules.network.f5.bigip_security_port_list import ModuleManager from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_port_list import ModuleManager
from ansible.modules.network.f5.bigip_security_port_list import ArgumentSpec from ansible_collections.community.general.plugins.modules.network.f5.bigip_security_port_list import ArgumentSpec
from ansible_collections.community.general.tests.unit.modules.utils import set_module_args from ansible_collections.community.general.tests.unit.modules.utils import set_module_args
except ImportError: except ImportError:
pytestmark.append(pytest.mark.skip("F5 Ansible modules require the f5-sdk Python library")) pytestmark.append(pytest.mark.skip("F5 Ansible modules require the f5-sdk Python library"))

View file

@ -47,7 +47,8 @@ def module_mock(mocker):
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def connection_mock(mocker): def connection_mock(mocker):
connection_class_mock = mocker.patch('ansible.modules.network.fortimanager.' connection_class_mock = mocker.patch('ansible_collections.community.general.'
'plugins.modules.network.fortimanager.'
'fmgr_device_provision_template.Connection') 'fmgr_device_provision_template.Connection')
return connection_class_mock return connection_class_mock

View file

@ -35,7 +35,8 @@ class TestConfigModule(TestIngateModule):
def setUp(self): def setUp(self):
super(TestConfigModule, self).setUp() super(TestConfigModule, self).setUp()
self.mock_make_request = patch('ansible.modules.network.ingate.' self.mock_make_request = patch('ansible_collections.community.general.'
'plugins.modules.network.ingate.'
'ig_config.make_request') 'ig_config.make_request')
self.make_request = self.mock_make_request.start() self.make_request = self.mock_make_request.start()
# ATM the Ingate Python SDK is not needed in this unit test. # ATM the Ingate Python SDK is not needed in this unit test.

View file

@ -21,11 +21,13 @@ class TestUnitInformationModule(TestIngateModule):
def setUp(self): def setUp(self):
super(TestUnitInformationModule, self).setUp() super(TestUnitInformationModule, self).setUp()
self.mock_make_request = patch('ansible.modules.network.ingate.' self.mock_make_request = patch('ansible_collections.community.general.'
'plugins.modules.network.ingate.'
'ig_unit_information.make_request') 'ig_unit_information.make_request')
self.make_request = self.mock_make_request.start() self.make_request = self.mock_make_request.start()
self.mock_is_ingatesdk_installed = patch('ansible.modules.network.ingate.' self.mock_is_ingatesdk_installed = patch('ansible_collections.community.general.'
'plugins.modules.network.ingate.'
'ig_unit_information.is_ingatesdk_installed') 'ig_unit_information.is_ingatesdk_installed')
self.is_ingatesdk_installed = self.mock_is_ingatesdk_installed.start() self.is_ingatesdk_installed = self.mock_is_ingatesdk_installed.start()

View file

@ -40,7 +40,7 @@ class OneViewBaseTest(object):
resource_module_path_name = 'oneview_' + str.join('_', resource_module_path_name).lower() resource_module_path_name = 'oneview_' + str.join('_', resource_module_path_name).lower()
ansible = __import__('ansible') ansible = __import__('ansible')
oneview_module = ansible.modules.remote_management.oneview oneview_module = ansible_collections.community.general.plugins.modules.remote_management.oneview
resource_module = getattr(oneview_module, resource_module_path_name) resource_module = getattr(oneview_module, resource_module_path_name)
self.testing_class = getattr(resource_module, resource_name) self.testing_class = getattr(resource_module, resource_name)
testing_module = self.testing_class.__module__.split('.')[-1] testing_module = self.testing_class.__module__.split('.')[-1]
@ -145,7 +145,7 @@ class OneViewBaseTestCase(object):
# Load scenarios from module examples (Also checks if it is a valid yaml) # Load scenarios from module examples (Also checks if it is a valid yaml)
ansible = __import__('ansible') ansible = __import__('ansible')
testing_module = self.testing_class.__module__.split('.')[-1] testing_module = self.testing_class.__module__.split('.')[-1]
self.testing_module = getattr(ansible.modules.remote_management.oneview, testing_module) self.testing_module = getattr(ansible_collections.community.general.plugins.modules.remote_management.oneview, testing_module)
try: try:
# Load scenarios from module examples (Also checks if it is a valid yaml) # Load scenarios from module examples (Also checks if it is a valid yaml)