summaryrefslogtreecommitdiff
path: root/test/units/modules
diff options
context:
space:
mode:
Diffstat (limited to 'test/units/modules')
-rw-r--r--test/units/modules/cloud/__init__.py0
-rw-r--r--test/units/modules/cloud/linode/__init__.py0
-rw-r--r--test/units/modules/cloud/linode/conftest.py80
-rw-r--r--test/units/modules/cloud/xenserver/__init__.py0
-rw-r--r--test/units/modules/cloud/xenserver/conftest.py75
-rw-r--r--test/units/modules/packaging/os/conftest.py29
-rw-r--r--test/units/modules/remote_management/__init__.py0
-rw-r--r--test/units/modules/remote_management/oneview/conftest.py23
8 files changed, 0 insertions, 207 deletions
diff --git a/test/units/modules/cloud/__init__.py b/test/units/modules/cloud/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/units/modules/cloud/__init__.py
+++ /dev/null
diff --git a/test/units/modules/cloud/linode/__init__.py b/test/units/modules/cloud/linode/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/units/modules/cloud/linode/__init__.py
+++ /dev/null
diff --git a/test/units/modules/cloud/linode/conftest.py b/test/units/modules/cloud/linode/conftest.py
deleted file mode 100644
index 9a7d7371f5..0000000000
--- a/test/units/modules/cloud/linode/conftest.py
+++ /dev/null
@@ -1,80 +0,0 @@
-import pytest
-
-
-@pytest.fixture
-def api_key(monkeypatch):
- monkeypatch.setenv('LINODE_API_KEY', 'foobar')
-
-
-@pytest.fixture
-def auth(monkeypatch):
- def patched_test_echo(dummy):
- return []
- monkeypatch.setattr('linode.api.Api.test_echo', patched_test_echo)
-
-
-@pytest.fixture
-def access_token(monkeypatch):
- monkeypatch.setenv('LINODE_ACCESS_TOKEN', 'barfoo')
-
-
-@pytest.fixture
-def no_access_token_in_env(monkeypatch):
- try:
- monkeypatch.delenv('LINODE_ACCESS_TOKEN')
- except KeyError:
- pass
-
-
-@pytest.fixture
-def default_args():
- return {'state': 'present', 'label': 'foo'}
-
-
-@pytest.fixture
-def mock_linode():
- class Linode():
- def delete(self, *args, **kwargs):
- pass
-
- @property
- def _raw_json(self):
- return {
- "alerts": {
- "cpu": 90,
- "io": 10000,
- "network_in": 10,
- "network_out": 10,
- "transfer_quota": 80
- },
- "backups": {
- "enabled": False,
- "schedule": {
- "day": None,
- "window": None,
- }
- },
- "created": "2018-09-26T08:12:33",
- "group": "Foobar Group",
- "hypervisor": "kvm",
- "id": 10480444,
- "image": "linode/centos7",
- "ipv4": [
- "130.132.285.233"
- ],
- "ipv6": "2a82:7e00::h03c:46ff:fe04:5cd2/64",
- "label": "lin-foo",
- "region": "eu-west",
- "specs": {
- "disk": 25600,
- "memory": 1024,
- "transfer": 1000,
- "vcpus": 1
- },
- "status": "running",
- "tags": [],
- "type": "g6-nanode-1",
- "updated": "2018-09-26T10:10:14",
- "watchdog_enabled": True
- }
- return Linode()
diff --git a/test/units/modules/cloud/xenserver/__init__.py b/test/units/modules/cloud/xenserver/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/units/modules/cloud/xenserver/__init__.py
+++ /dev/null
diff --git a/test/units/modules/cloud/xenserver/conftest.py b/test/units/modules/cloud/xenserver/conftest.py
deleted file mode 100644
index f93b6c60b4..0000000000
--- a/test/units/modules/cloud/xenserver/conftest.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright: (c) 2019, Bojan Vitnik <bvitnik@mainstream.rs>
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-
-from __future__ import absolute_import, division, print_function
-__metaclass__ = type
-
-
-import sys
-import importlib
-import pytest
-
-from .FakeAnsibleModule import FakeAnsibleModule
-
-
-@pytest.fixture
-def fake_ansible_module(request):
- """Returns fake AnsibleModule with fake module params."""
- if hasattr(request, 'param'):
- return FakeAnsibleModule(request.param)
- else:
- params = {
- "hostname": "somehost",
- "username": "someuser",
- "password": "somepwd",
- "validate_certs": True,
- }
-
- return FakeAnsibleModule(params)
-
-
-@pytest.fixture(autouse=True)
-def XenAPI():
- """Imports and returns fake XenAPI module."""
-
- # Import of fake XenAPI module is wrapped by fixture so that it does not
- # affect other unit tests which could potentialy also use XenAPI module.
-
- # First we use importlib.import_module() to import the module and assign
- # it to a local symbol.
- fake_xenapi = importlib.import_module('units.modules.cloud.xenserver.FakeXenAPI')
-
- # Now we populate Python module cache with imported fake module using the
- # original module name (XenAPI). That way, any 'import XenAPI' statement
- # will just load already imported fake module from the cache.
- sys.modules['XenAPI'] = fake_xenapi
-
- return fake_xenapi
-
-
-@pytest.fixture
-def xenserver_guest_info(XenAPI):
- """Imports and returns xenserver_guest_info module."""
-
- # Since we are wrapping fake XenAPI module inside a fixture, all modules
- # that depend on it have to be imported inside a test function. To make
- # this easier to handle and remove some code repetition, we wrap the import
- # of xenserver_guest_info module with a fixture.
- from ansible.modules.cloud.xenserver import xenserver_guest_info
-
- return xenserver_guest_info
-
-
-@pytest.fixture
-def xenserver_guest_powerstate(XenAPI):
- """Imports and returns xenserver_guest_powerstate module."""
-
- # Since we are wrapping fake XenAPI module inside a fixture, all modules
- # that depend on it have to be imported inside a test function. To make
- # this easier to handle and remove some code repetition, we wrap the import
- # of xenserver_guest_powerstate module with a fixture.
- from ansible.modules.cloud.xenserver import xenserver_guest_powerstate
-
- return xenserver_guest_powerstate
diff --git a/test/units/modules/packaging/os/conftest.py b/test/units/modules/packaging/os/conftest.py
deleted file mode 100644
index 1c5560a909..0000000000
--- a/test/units/modules/packaging/os/conftest.py
+++ /dev/null
@@ -1,29 +0,0 @@
-from units.compat.mock import patch
-from ansible.module_utils.six.moves import xmlrpc_client
-
-import pytest
-
-
-def get_method_name(request_body):
- return xmlrpc_client.loads(request_body)[1]
-
-
-@pytest.fixture
-def mock_request(request, mocker):
- responses = request.getfixturevalue('testcase')['calls']
- module_name = request.module.TESTED_MODULE
-
- def transport_request(host, handler, request_body, verbose=0):
- """Fake request"""
- method_name = get_method_name(request_body)
- excepted_name, response = responses.pop(0)
- if method_name == excepted_name:
- if isinstance(response, Exception):
- raise response
- else:
- return response
- else:
- raise Exception('Expected call: %r, called with: %r' % (excepted_name, method_name))
-
- target = '{0}.xmlrpc_client.Transport.request'.format(module_name)
- mocker.patch(target, side_effect=transport_request)
diff --git a/test/units/modules/remote_management/__init__.py b/test/units/modules/remote_management/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/units/modules/remote_management/__init__.py
+++ /dev/null
diff --git a/test/units/modules/remote_management/oneview/conftest.py b/test/units/modules/remote_management/oneview/conftest.py
deleted file mode 100644
index 715d9cdc49..0000000000
--- a/test/units/modules/remote_management/oneview/conftest.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
-# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-import pytest
-
-from mock import Mock, patch
-from oneview_module_loader import ONEVIEW_MODULE_UTILS_PATH
-from hpOneView.oneview_client import OneViewClient
-
-
-@pytest.fixture
-def mock_ov_client():
- patcher_json_file = patch.object(OneViewClient, 'from_json_file')
- client = patcher_json_file.start()
- return client.return_value
-
-
-@pytest.fixture
-def mock_ansible_module():
- patcher_ansible = patch(ONEVIEW_MODULE_UTILS_PATH + '.AnsibleModule')
- patcher_ansible = patcher_ansible.start()
- ansible_module = Mock()
- patcher_ansible.return_value = ansible_module
- return ansible_module