mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
Sort imports with ruff check --fix (#11400)
Sort imports with ruff check --fix.
This commit is contained in:
parent
0e6ba07261
commit
236b9c0e04
829 changed files with 1644 additions and 1692 deletions
|
|
@ -8,7 +8,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.cli.arguments import option_helpers as opt_help
|
||||
from ansible.utils import context_objects as co
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import re
|
||||
|
||||
from ansible import context
|
||||
|
|
|
|||
1
tests/unit/plugins/cache/test_memcached.py
vendored
1
tests/unit/plugins/cache/test_memcached.py
vendored
|
|
@ -10,6 +10,7 @@ import pytest
|
|||
pytest.importorskip("memcache")
|
||||
|
||||
from ansible.plugins.loader import cache_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.cache.memcached import CacheModule as MemcachedCache
|
||||
|
||||
|
||||
|
|
|
|||
1
tests/unit/plugins/cache/test_redis.py
vendored
1
tests/unit/plugins/cache/test_redis.py
vendored
|
|
@ -10,6 +10,7 @@ import pytest
|
|||
pytest.importorskip("redis")
|
||||
|
||||
from ansible.plugins.loader import cache_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.cache.redis import CacheModule as RedisCache
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ from __future__ import annotations
|
|||
|
||||
import unittest
|
||||
from collections import OrderedDict
|
||||
from unittest.mock import patch, MagicMock, Mock
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from ansible.playbook.task import Task
|
||||
from ansible.executor.task_result import TaskResult
|
||||
from ansible.playbook.task import Task
|
||||
|
||||
from ansible_collections.community.general.plugins.callback.elastic import ElasticSource, TaskData
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@ from __future__ import annotations
|
|||
import json
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from unittest.mock import patch, Mock
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from ansible.executor.task_result import TaskResult
|
||||
|
||||
from ansible_collections.community.general.plugins.callback.loganalytics import AzureLogAnalyticsSource
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ from __future__ import annotations
|
|||
|
||||
import unittest
|
||||
from collections import OrderedDict
|
||||
from unittest.mock import patch, MagicMock, Mock
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from ansible.playbook.task import Task
|
||||
from ansible.executor.task_result import TaskResult
|
||||
from ansible.playbook.task import Task
|
||||
|
||||
from ansible_collections.community.general.plugins.callback.opentelemetry import OpenTelemetrySource, TaskData
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch, Mock
|
||||
from ansible.executor.task_result import TaskResult
|
||||
from ansible_collections.community.general.plugins.callback.splunk import SplunkHTTPCollectorSource
|
||||
from datetime import datetime
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from ansible.executor.task_result import TaskResult
|
||||
|
||||
from ansible_collections.community.general.plugins.callback.splunk import SplunkHTTPCollectorSource
|
||||
|
||||
|
||||
class TestSplunkClient(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@
|
|||
# Make coding more python3-ish
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
from io import StringIO
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.playbook.play_context import PlayContext
|
||||
from ansible.plugins.loader import connection_loader
|
||||
|
|
|
|||
|
|
@ -5,18 +5,18 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import os
|
||||
import pytest
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, mock_open, patch
|
||||
|
||||
from ansible_collections.community.general.plugins.connection.wsl import authenticity_msg, MyAddPolicy
|
||||
from ansible_collections.community.general.plugins.module_utils._filelock import FileLock, LockTimeout
|
||||
from ansible.errors import AnsibleError, AnsibleAuthenticationFailure, AnsibleConnectionFailure
|
||||
import pytest
|
||||
from ansible.errors import AnsibleAuthenticationFailure, AnsibleConnectionFailure, AnsibleError
|
||||
from ansible.module_utils.common.text.converters import to_bytes
|
||||
from ansible.playbook.play_context import PlayContext
|
||||
from ansible.plugins.loader import connection_loader
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock, mock_open
|
||||
|
||||
from ansible_collections.community.general.plugins.connection.wsl import MyAddPolicy, authenticity_msg
|
||||
from ansible_collections.community.general.plugins.module_utils._filelock import FileLock, LockTimeout
|
||||
|
||||
paramiko = pytest.importorskip("paramiko")
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import unittest
|
||||
from ansible_collections.community.general.plugins.filter.json_patch import FilterModule
|
||||
|
||||
from ansible.errors import AnsibleFilterError
|
||||
|
||||
from ansible_collections.community.general.plugins.filter.json_patch import FilterModule
|
||||
|
||||
|
||||
class TestJsonPatch(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.inventory.data import InventoryData
|
||||
|
||||
from ansible_collections.community.general.plugins.inventory.icinga2 import InventoryModule
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.inventory.data import InventoryData
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.template import Templar
|
||||
|
||||
from ansible_collections.community.general.plugins.inventory.incus import (
|
||||
InventoryModule,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ from __future__ import annotations
|
|||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from ansible.inventory.data import InventoryData
|
||||
from ansible.template import Templar
|
||||
from ansible_collections.community.general.plugins.inventory.iocage import InventoryModule
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.utils.trust import make_trusted
|
||||
|
||||
from ansible_collections.community.general.plugins.inventory.iocage import InventoryModule
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def inventory():
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ linode_apiv4 = pytest.importorskip("linode_api4")
|
|||
from ansible.errors import AnsibleError
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.template import Templar
|
||||
|
||||
from ansible_collections.community.general.plugins.inventory.linode import InventoryModule
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.inventory.data import InventoryData
|
||||
from ansible_collections.community.general.plugins.inventory.lxd import InventoryModule
|
||||
|
||||
from ansible_collections.community.general.plugins.inventory.lxd import InventoryModule
|
||||
|
||||
HOST_COMPARATIVE_DATA = {
|
||||
"ansible_connection": "ssh",
|
||||
|
|
|
|||
|
|
@ -6,13 +6,11 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from collections import OrderedDict
|
||||
import json
|
||||
import os
|
||||
from collections import OrderedDict
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.inventory.data import InventoryData
|
||||
from ansible.inventory.manager import InventoryManager
|
||||
|
|
@ -22,7 +20,6 @@ from ansible_collections.community.internal_test_tools.tests.unit.mock.path impo
|
|||
|
||||
from ansible_collections.community.general.plugins.inventory.opennebula import InventoryModule
|
||||
|
||||
|
||||
original_exists = os.path.exists
|
||||
original_access = os.access
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.inventory.data import InventoryData
|
||||
|
||||
from ansible_collections.community.general.plugins.inventory.xen_orchestra import InventoryModule
|
||||
|
||||
objects = {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import json
|
||||
import os
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup.onepassword import (
|
||||
OnePassCLIv1,
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ import unittest
|
|||
from unittest.mock import patch
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
from ansible_collections.community.general.plugins.lookup.bitwarden import Bitwarden, BitwardenException
|
||||
from ansible.parsing.ajson import AnsibleJSONEncoder
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup.bitwarden import Bitwarden, BitwardenException
|
||||
|
||||
MOCK_COLLECTION_ID = "3b12a9da-7c49-40b8-ad33-aede017a7ead"
|
||||
MOCK_ORGANIZATION_ID = "292ba0c6-f289-11ee-9301-ef7b639ccd2a"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ from unittest.mock import patch
|
|||
|
||||
from ansible.errors import AnsibleLookupError
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
from ansible_collections.community.general.plugins.lookup.bitwarden_secrets_manager import BitwardenSecretsManager
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup.bitwarden_secrets_manager import BitwardenSecretsManager
|
||||
|
||||
MOCK_SECRETS = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ from unittest import TestCase
|
|||
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
from ansible.template import Templar
|
||||
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.utils.trust import make_trusted
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@ from __future__ import annotations
|
|||
|
||||
from unittest import TestCase
|
||||
from unittest.mock import (
|
||||
patch,
|
||||
MagicMock,
|
||||
patch,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import dsv
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import dsv
|
||||
|
||||
|
||||
class MockSecretsVault(MagicMock):
|
||||
RESPONSE = '{"foo": "bar"}'
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import etcd3
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
|
||||
class FakeKVMetadata:
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import sys
|
|||
import types
|
||||
import unittest
|
||||
from unittest.mock import (
|
||||
patch,
|
||||
MagicMock,
|
||||
mock_open,
|
||||
patch,
|
||||
)
|
||||
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ from unittest.mock import patch
|
|||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
from ansible_collections.community.general.plugins.lookup.lastpass import LPass, LPassException
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup.lastpass import LPass, LPassException
|
||||
|
||||
MOCK_ENTRIES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ from __future__ import annotations
|
|||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.mock.loader import DictDataLoader
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins import AnsiblePlugin
|
||||
from ansible.template import Templar
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.utils.display import Display
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.mock.loader import DictDataLoader
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import merge_variables
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import operator
|
||||
import itertools
|
||||
import json
|
||||
import operator
|
||||
|
||||
import pytest
|
||||
|
||||
from .onepassword_common import MOCK_ENTRIES
|
||||
|
||||
from ansible.errors import AnsibleLookupError, AnsibleOptionsError
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup.onepassword import (
|
||||
OnePassCLIv1,
|
||||
OnePassCLIv2,
|
||||
)
|
||||
|
||||
from .onepassword_common import MOCK_ENTRIES
|
||||
|
||||
OP_VERSION_FIXTURES = ["opv1", "opv2"]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from .onepassword_common import SSH_KEY_MOCK_ENTRIES
|
||||
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("vault", "queries", "kwargs", "output", "expected"),
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ from __future__ import annotations
|
|||
|
||||
from unittest import TestCase
|
||||
from unittest.mock import (
|
||||
patch,
|
||||
MagicMock,
|
||||
patch,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import revbitspss
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import revbitspss
|
||||
|
||||
|
||||
class MockPamSecrets(MagicMock):
|
||||
RESPONSE = "dummy value"
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ from __future__ import annotations
|
|||
|
||||
from unittest import TestCase
|
||||
from unittest.mock import (
|
||||
patch,
|
||||
DEFAULT,
|
||||
MagicMock,
|
||||
patch,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import tss
|
||||
from ansible.plugins.loader import lookup_loader
|
||||
|
||||
from ansible_collections.community.general.plugins.lookup import tss
|
||||
|
||||
TSS_IMPORT_PATH = "ansible_collections.community.general.plugins.lookup.tss"
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,15 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from io import StringIO
|
||||
from itertools import count
|
||||
from urllib.error import HTTPError
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import (
|
||||
get_token,
|
||||
KeycloakError,
|
||||
get_token,
|
||||
)
|
||||
|
||||
module_params_creds = {
|
||||
|
|
|
|||
|
|
@ -8,13 +8,12 @@ import json
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.net_tools.pritunl import (
|
||||
api,
|
||||
)
|
||||
|
||||
|
||||
# Pritunl Mocks
|
||||
|
||||
PRITUNL_ORGS = [
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import pytest
|
|||
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
||||
|
||||
|
||||
TC_FORMATS = dict(
|
||||
simple_boolean__true=(partial(cmd_runner_fmt.as_bool, "--superflag"), True, ["--superflag"], None),
|
||||
simple_boolean__false=(partial(cmd_runner_fmt.as_bool, "--superflag"), False, [], None),
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import pytest
|
|||
|
||||
from ansible_collections.community.general.plugins.module_utils import csv
|
||||
|
||||
|
||||
VALID_CSV = [
|
||||
(
|
||||
"excel",
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ from __future__ import annotations
|
|||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.database import (
|
||||
SQLParseError,
|
||||
is_input_dangerous,
|
||||
pg_quote_identifier,
|
||||
SQLParseError,
|
||||
)
|
||||
|
||||
# These are all valid strings
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import pytest
|
|||
|
||||
from ansible_collections.community.general.plugins.module_utils import known_hosts
|
||||
|
||||
|
||||
URLS = {
|
||||
"ssh://one.example.org/example.git": {
|
||||
"is_ssh_url": True,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import pytest
|
|||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import cause_changes
|
||||
|
||||
|
||||
#
|
||||
# DEPRECATION NOTICE
|
||||
# Parameters on_success and on_failure are deprecated and will be removed in community.general 12.0.0
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import pytest
|
|||
|
||||
from ansible_collections.community.general.plugins.module_utils.opennebula import flatten, render
|
||||
|
||||
|
||||
FLATTEN_VALID = [
|
||||
([[[1]], [2], 3], False, [1, 2, 3]),
|
||||
([[[1]], [2], 3], True, [1, 2, 3]),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import pytest
|
|||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import cmd_runner_fmt
|
||||
from ansible_collections.community.general.plugins.module_utils.python_runner import PythonRunner
|
||||
|
||||
|
||||
TC_RUNNER = dict(
|
||||
# SAMPLE: This shows all possible elements of a test case. It does not actually run.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import pytest
|
|||
|
||||
from ansible_collections.community.general.plugins.module_utils.saslprep import saslprep
|
||||
|
||||
|
||||
VALID = [
|
||||
("", ""),
|
||||
("\u00a0", " "),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.vardict import VarDict
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import sys
|
||||
import importlib
|
||||
import os
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from .common import testcase_bad_xenapi_refs
|
||||
|
||||
|
||||
testcase_gather_vm_params_and_facts = {
|
||||
"params": [
|
||||
["ansible-test-vm-1-params.json", "ansible-test-vm-1-facts.json"],
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
from .common import fake_xenapi_ref
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
|
||||
|
||||
def test_get_object_ref_xenapi_failure(mocker, fake_ansible_module, XenAPI, xenserver):
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.module_utils.common.network import is_mac
|
||||
|
||||
testcase_is_valid_mac_addr = [
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
from .common import fake_xenapi_ref, testcase_bad_xenapi_refs
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
|
||||
testcase_set_vm_power_state_bad_transitions = {
|
||||
"params": [
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
from .common import fake_xenapi_ref, testcase_bad_xenapi_refs
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
|
||||
testcase_wait_for_vm_ip_address_bad_power_states = {
|
||||
"params": [
|
||||
|
|
|
|||
|
|
@ -5,13 +5,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import pytest
|
||||
import atexit
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
import pytest
|
||||
from ansible.module_utils.ansible_release import __version__ as ANSIBLE_VERSION
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
|
||||
testcase_module_local_conn = {
|
||||
"params": [
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
from .common import fake_xenapi_ref
|
||||
from .FakeAnsibleModule import FailJsonException
|
||||
|
||||
|
||||
def test_xenserverobject_xenapi_lib_detection(mocker, fake_ansible_module, xenserver):
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ import json
|
|||
from collections.abc import MutableMapping
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils import deps
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
set_module_args as _set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils import deps
|
||||
|
||||
|
||||
def _fix_ansible_args(args):
|
||||
if isinstance(args, str):
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ from __future__ import annotations
|
|||
|
||||
import unittest
|
||||
|
||||
from httmock import response # noqa
|
||||
from httmock import urlmatch # noqa
|
||||
|
||||
import gitlab
|
||||
from httmock import (
|
||||
response, # noqa
|
||||
urlmatch, # noqa
|
||||
)
|
||||
|
||||
|
||||
class FakeAnsibleModule:
|
||||
|
|
|
|||
|
|
@ -5,12 +5,15 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
import re
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from .oneview_module_loader import ONEVIEW_MODULE_UTILS_PATH
|
||||
from hpOneView.oneview_client import OneViewClient
|
||||
|
||||
# This import must come *after* the oneview_module_loader import!
|
||||
from hpOneView.oneview_client import OneViewClient # isort: skip
|
||||
|
||||
|
||||
class OneViewBaseTest:
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import interfaces_file
|
||||
from shutil import copyfile, move
|
||||
import difflib
|
||||
import inspect
|
||||
import json
|
||||
|
|
@ -17,6 +15,9 @@ import re
|
|||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
from shutil import copyfile, move
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import interfaces_file
|
||||
|
||||
|
||||
class AnsibleFailJson(Exception):
|
||||
|
|
|
|||
|
|
@ -4,11 +4,14 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
from .oneview_module_loader import ONEVIEW_MODULE_UTILS_PATH
|
||||
from hpOneView.oneview_client import OneViewClient
|
||||
|
||||
# This import must come *after* the oneview_module_loader import!
|
||||
from hpOneView.oneview_client import OneViewClient # isort: skip
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
|
|
@ -15,21 +15,38 @@ if "hpOneView" not in sys.modules:
|
|||
|
||||
ONEVIEW_MODULE_UTILS_PATH = "ansible_collections.community.general.plugins.module_utils.oneview"
|
||||
from ansible_collections.community.general.plugins.module_utils.oneview import ( # noqa: F401, pylint: disable=unused-import
|
||||
OneViewModuleException,
|
||||
OneViewModuleTaskError,
|
||||
OneViewModuleResourceNotFound,
|
||||
OneViewModuleBase,
|
||||
OneViewModuleException,
|
||||
OneViewModuleResourceNotFound,
|
||||
OneViewModuleTaskError,
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_ethernet_network import ( # pylint: disable=unused-import
|
||||
EthernetNetworkModule, # noqa: F401
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.oneview_ethernet_network import EthernetNetworkModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_ethernet_network_info import ( # noqa: F401, pylint: disable=unused-import
|
||||
EthernetNetworkInfoModule,
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fc_network import FcNetworkModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fc_network_info import FcNetworkInfoModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fcoe_network import FcoeNetworkModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fcoe_network_info import FcoeNetworkInfoModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_network_set import NetworkSetModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_network_set_info import NetworkSetInfoModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_san_manager import SanManagerModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_san_manager_info import SanManagerInfoModule # noqa: F401, pylint: disable=unused-import
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fc_network import ( # pylint: disable=unused-import
|
||||
FcNetworkModule, # noqa: F401
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fc_network_info import ( # pylint: disable=unused-import
|
||||
FcNetworkInfoModule, # noqa: F401
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fcoe_network import ( # pylint: disable=unused-import
|
||||
FcoeNetworkModule, # noqa: F401
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_fcoe_network_info import ( # pylint: disable=unused-import
|
||||
FcoeNetworkInfoModule, # noqa: F401
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_network_set import ( # pylint: disable=unused-import
|
||||
NetworkSetModule, # noqa: F401
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_network_set_info import ( # pylint: disable=unused-import
|
||||
NetworkSetInfoModule, # noqa: F401
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_san_manager import ( # pylint: disable=unused-import
|
||||
SanManagerModule, # noqa: F401
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.oneview_san_manager_info import ( # pylint: disable=unused-import
|
||||
SanManagerInfoModule, # noqa: F401
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import json
|
|||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.general.plugins.modules import alerta_customer
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
|
|
@ -16,6 +15,8 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module
|
|||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import alerta_customer
|
||||
|
||||
|
||||
class MockedReponse:
|
||||
def __init__(self, data):
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest import mock
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import apk
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,15 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.archive import get_archive, common_path, create_module
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.archive import common_path, create_module, get_archive
|
||||
|
||||
|
||||
class TestArchive(ModuleTestCase):
|
||||
|
|
|
|||
|
|
@ -6,15 +6,16 @@ from __future__ import annotations
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_access_key
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleFailJson,
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_access_key
|
||||
|
||||
|
||||
class TestBucketAccessKeyModule(ModuleTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -6,15 +6,16 @@ from __future__ import annotations
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_pipeline_key_pair
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleFailJson,
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_pipeline_key_pair
|
||||
|
||||
|
||||
class TestBucketPipelineKeyPairModule(ModuleTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ from __future__ import annotations
|
|||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_pipeline_known_host
|
||||
from ansible_collections.community.general.plugins.modules.bitbucket_pipeline_known_host import HAS_PARAMIKO
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_pipeline_known_host
|
||||
from ansible_collections.community.general.plugins.modules.bitbucket_pipeline_known_host import HAS_PARAMIKO
|
||||
|
||||
|
||||
class TestBucketPipelineKnownHostModule(ModuleTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -6,15 +6,16 @@ from __future__ import annotations
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_pipeline_variable
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleFailJson,
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
from ansible_collections.community.general.plugins.modules import bitbucket_pipeline_variable
|
||||
|
||||
|
||||
class TestBucketPipelineVariableModule(ModuleTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules import bootc_manage
|
||||
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
|
|
@ -13,6 +13,8 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module
|
|||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import bootc_manage
|
||||
|
||||
|
||||
class TestBootcManageModule(ModuleTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules import campfire
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
|
|
@ -14,6 +14,8 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module
|
|||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import campfire
|
||||
|
||||
|
||||
class TestCampfireModule(ModuleTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -9,16 +9,17 @@ import json
|
|||
import re
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
from urllib3.response import HTTPResponse
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_bytes
|
||||
from ansible_collections.community.general.plugins.modules import circonus_annotation
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
from urllib3.response import HTTPResponse
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import circonus_annotation
|
||||
|
||||
|
||||
class TestCirconusAnnotation(ModuleTestCase):
|
||||
|
|
|
|||
|
|
@ -7,9 +7,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import composer
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(composer, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import cpanm
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(cpanm, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import datadog_downtime
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
|
||||
from pytest import importorskip
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import datadog_downtime
|
||||
|
||||
# Skip this test if datadog_api_client cannot be installed
|
||||
datadog_api_client = importorskip("datadog_api_client")
|
||||
Downtime = datadog_api_client.v1.model.downtime.Downtime
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ import json
|
|||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import discord
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
|
|
@ -17,6 +15,8 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module
|
|||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import discord
|
||||
|
||||
|
||||
class TestDiscordModule(ModuleTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import django_check
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(django_check, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import django_command
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(django_command, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import django_createcachetable
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(django_createcachetable, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import django_dumpdata
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(django_dumpdata, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import django_loaddata
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(django_loaddata, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch, call
|
||||
from ansible_collections.community.general.plugins.modules import dnf_config_manager as dnf_config_manager_module
|
||||
from unittest.mock import call, patch
|
||||
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
|
|
@ -12,6 +12,8 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module
|
|||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import dnf_config_manager as dnf_config_manager_module
|
||||
|
||||
# Return value on all-default arguments
|
||||
mock_repolist_crb_enabled = """Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install
|
||||
DNF version: 4.14.0
|
||||
|
|
|
|||
|
|
@ -4,14 +4,16 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import dnsimple as dnsimple_module
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import dnsimple as dnsimple_module
|
||||
|
||||
dnsimple = pytest.importorskip("dnsimple")
|
||||
|
||||
|
|
|
|||
|
|
@ -4,17 +4,15 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import dnsimple_info
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
AnsibleExitJson,
|
||||
)
|
||||
from httmock import response
|
||||
from httmock import with_httmock
|
||||
from httmock import urlmatch
|
||||
from httmock import response, urlmatch, with_httmock
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import dnsimple_info
|
||||
|
||||
|
||||
@urlmatch(netloc="(.)*dnsimple.com(.)*", path="/v2/[0-9]*/zones/")
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import facter_facts
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(facter_facts, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import gconftool2
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(gconftool2, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import gconftool2_info
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(gconftool2_info, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ from __future__ import annotations
|
|||
import copy
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import gem
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
|
|
@ -15,6 +13,8 @@ from ansible_collections.community.internal_test_tools.tests.unit.plugins.module
|
|||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import gem
|
||||
|
||||
|
||||
def get_command(run_command):
|
||||
"""Generate the command line string from the patched run_command"""
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import gio_mime
|
||||
from .uthelper import UTHelper, RunCommandMock
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
|
||||
UTHelper.from_module(gio_mime, __name__, mocks=[RunCommandMock])
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import json
|
||||
import re
|
||||
import unittest
|
||||
import pytest
|
||||
from httmock import with_httmock, urlmatch, response
|
||||
from ansible_collections.community.general.plugins.modules import github_repo
|
||||
|
||||
import pytest
|
||||
from httmock import response, urlmatch, with_httmock
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import github_repo
|
||||
|
||||
pytest.importorskip("github")
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,16 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_get_project,
|
||||
resp_find_project_deploy_key,
|
||||
resp_create_project_deploy_key,
|
||||
resp_delete_project_deploy_key,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import ProjectKey
|
||||
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_create_project_deploy_key,
|
||||
resp_delete_project_deploy_key,
|
||||
resp_find_project_deploy_key,
|
||||
resp_get_project,
|
||||
)
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("Could not load gitlab module required for testing"))
|
||||
# Need to set these to something so that we don't fail when parsing
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import Group
|
||||
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_get_group,
|
||||
resp_get_missing_group,
|
||||
resp_create_group,
|
||||
resp_create_subgroup,
|
||||
resp_delete_group,
|
||||
resp_find_group_project,
|
||||
resp_get_group,
|
||||
resp_get_missing_group,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import Group
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("Could not load gitlab module required for testing"))
|
||||
# Need to set these to something so that we don't fail when parsing
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
import gitlab
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.gitlab_group_access_token import GitLabGroupAccessToken
|
||||
|
||||
|
|
@ -27,10 +27,10 @@ pytestmark = []
|
|||
try:
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_get_user,
|
||||
resp_get_group,
|
||||
resp_list_group_access_tokens,
|
||||
resp_create_group_access_tokens,
|
||||
resp_get_group,
|
||||
resp_get_user,
|
||||
resp_list_group_access_tokens,
|
||||
resp_revoke_group_access_tokens,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,16 +17,16 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_get_project,
|
||||
resp_find_project_hook,
|
||||
resp_create_project_hook,
|
||||
resp_delete_project_hook,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import ProjectHook
|
||||
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_create_project_hook,
|
||||
resp_delete_project_hook,
|
||||
resp_find_project_hook,
|
||||
resp_get_project,
|
||||
)
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("Could not load gitlab module required for testing"))
|
||||
# Need to set these to something so that we don't fail when parsing
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_get_group,
|
||||
resp_get_project_by_name,
|
||||
resp_create_project,
|
||||
resp_get_project,
|
||||
resp_delete_project,
|
||||
resp_get_user,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import Project
|
||||
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_create_project,
|
||||
resp_delete_project,
|
||||
resp_get_group,
|
||||
resp_get_project,
|
||||
resp_get_project_by_name,
|
||||
resp_get_user,
|
||||
)
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("Could not load gitlab module required for testing"))
|
||||
# Need to set these to something so that we don't fail when parsing
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
import gitlab
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.gitlab_project_access_token import GitLabProjectAccessToken
|
||||
|
||||
|
|
@ -27,10 +27,10 @@ pytestmark = []
|
|||
try:
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_get_user,
|
||||
resp_get_project,
|
||||
resp_list_project_access_tokens,
|
||||
resp_create_project_access_tokens,
|
||||
resp_get_project,
|
||||
resp_get_user,
|
||||
resp_list_project_access_tokens,
|
||||
resp_revoke_project_access_tokens,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ from __future__ import annotations
|
|||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.gitlab_protected_branch import GitlabProtectedBranch
|
||||
|
||||
|
||||
|
|
@ -19,20 +18,20 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import Project # noqa: F401, pylint: disable=unused-import
|
||||
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
python_gitlab_module_version,
|
||||
python_gitlab_version_match_requirement,
|
||||
resp_get_protected_branch,
|
||||
resp_get_project_by_name,
|
||||
resp_get_protected_branch_not_exist,
|
||||
resp_delete_protected_branch,
|
||||
resp_get_project_by_name,
|
||||
resp_get_protected_branch,
|
||||
resp_get_protected_branch_not_exist,
|
||||
resp_get_user,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import Project # noqa: F401, pylint: disable=unused-import
|
||||
|
||||
gitlab_req_version = python_gitlab_version_match_requirement()
|
||||
gitlab_module_version = python_gitlab_module_version()
|
||||
if LooseVersion(gitlab_module_version) < LooseVersion(gitlab_req_version):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import gitlab
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.gitlab_runner import GitLabRunner
|
||||
|
|
@ -19,22 +18,22 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import Runner
|
||||
|
||||
from .gitlab import (
|
||||
FakeAnsibleModule,
|
||||
GitlabModuleTestCase,
|
||||
resp_find_runners_all,
|
||||
resp_find_runners_list,
|
||||
resp_find_project_runners,
|
||||
resp_find_group_runners,
|
||||
resp_get_runner,
|
||||
resp_create_runner,
|
||||
resp_delete_runner,
|
||||
resp_get_project_by_name,
|
||||
resp_find_group_runners,
|
||||
resp_find_project_runners,
|
||||
resp_find_runners_all,
|
||||
resp_find_runners_list,
|
||||
resp_get_group_by_name,
|
||||
resp_get_project_by_name,
|
||||
resp_get_runner,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import Runner
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("Could not load gitlab module required for testing"))
|
||||
# Need to set these to something so that we don't fail when parsing
|
||||
|
|
|
|||
|
|
@ -17,23 +17,22 @@ def _dummy(x):
|
|||
|
||||
pytestmark = []
|
||||
try:
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_find_user,
|
||||
resp_get_user,
|
||||
resp_get_user_keys,
|
||||
resp_create_user_keys,
|
||||
resp_create_user,
|
||||
resp_delete_user,
|
||||
resp_get_member,
|
||||
resp_get_group,
|
||||
resp_add_member,
|
||||
resp_update_member,
|
||||
resp_get_member,
|
||||
)
|
||||
|
||||
# GitLab module requirements
|
||||
from gitlab.v4.objects import User
|
||||
|
||||
from .gitlab import (
|
||||
GitlabModuleTestCase,
|
||||
resp_add_member,
|
||||
resp_create_user,
|
||||
resp_create_user_keys,
|
||||
resp_delete_user,
|
||||
resp_find_user,
|
||||
resp_get_group,
|
||||
resp_get_member,
|
||||
resp_get_user,
|
||||
resp_get_user_keys,
|
||||
resp_update_member,
|
||||
)
|
||||
except ImportError:
|
||||
pytestmark.append(pytest.mark.skip("Could not load gitlab module required for testing"))
|
||||
# Need to set these to something so that we don't fail when parsing
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.homebrew import HomebrewValidate
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.homebrew_cask import (
|
||||
HomebrewCask,
|
||||
)
|
||||
from ansible_collections.community.general.plugins.module_utils.homebrew import (
|
||||
HomebrewValidate,
|
||||
)
|
||||
from ansible_collections.community.general.plugins.modules.homebrew_cask import (
|
||||
HomebrewCask,
|
||||
)
|
||||
|
||||
|
||||
def test_valid_cask_names():
|
||||
|
|
|
|||
|
|
@ -7,14 +7,16 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules import icinga2_feature
|
||||
|
||||
from ansible.module_utils import basic
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
AnsibleFailJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
from ansible.module_utils import basic
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import icinga2_feature
|
||||
|
||||
|
||||
def get_bin_path(*args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ from unittest.mock import Mock, patch
|
|||
|
||||
from ansible_collections.community.general.plugins.modules.ip2location_info import Ip2LocationInfo
|
||||
|
||||
|
||||
IP2LOCATION_DATA = {
|
||||
"ip": "8.8.8.8",
|
||||
"country_code": "US",
|
||||
|
|
|
|||
|
|
@ -6,13 +6,15 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import call, patch
|
||||
from ansible_collections.community.general.plugins.modules import ipa_getkeytab
|
||||
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson,
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import ipa_getkeytab
|
||||
|
||||
|
||||
class IPAKeytabModuleTestCase(ModuleTestCase):
|
||||
module = ipa_getkeytab
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.ipbase_info import IpbaseInfo
|
||||
import unittest
|
||||
from unittest.mock import Mock
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.ipbase_info import IpbaseInfo
|
||||
|
||||
IPBASE_DATA = {
|
||||
"response": b"""
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from unittest.mock import patch, Mock
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule # noqa: F401 # pylint: disable=unused-import
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import (
|
||||
ModuleTestCase,
|
||||
set_module_args,
|
||||
)
|
||||
from ansible.module_utils.basic import AnsibleModule # noqa: F401 # pylint: disable=unused-import
|
||||
|
||||
from ansible_collections.community.general.plugins.modules.java_keystore import JavaKeystore, create_module
|
||||
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue