mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-08 21:17:20 +00:00
Stop re-defining the argument spec in unit tests (#11235)
* Stop re-defining the argument spec in unit tests. * Shut up linter.
This commit is contained in:
parent
6365b5a981
commit
fb2f34ba85
6 changed files with 35 additions and 274 deletions
|
|
@ -10,7 +10,7 @@ import pytest
|
|||
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
from ansible_collections.community.general.plugins.modules import nmcli
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule # noqa: F401 # pylint: disable=unused-import
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("patch_ansible_module")
|
||||
|
||||
|
|
@ -4576,181 +4576,7 @@ def test_bond_connection_unchanged_2(mocked_generic_connection_diff_check, capfd
|
|||
Test : Bond connection unchanged
|
||||
"""
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
ignore_unsupported_suboptions=dict(type="bool", default=False),
|
||||
autoconnect=dict(type="bool", default=True),
|
||||
autoconnect_priority=dict(type="int"),
|
||||
autoconnect_retries=dict(type="int"),
|
||||
state=dict(type="str", required=True, choices=["absent", "present"]),
|
||||
conn_name=dict(type="str", required=True),
|
||||
conn_reload=dict(type="bool", required=False, default=False),
|
||||
master=dict(type="str"),
|
||||
slave_type=dict(type=str, choices=["bond", "bridge", "team"]),
|
||||
ifname=dict(type="str"),
|
||||
type=dict(
|
||||
type="str",
|
||||
choices=[
|
||||
"bond",
|
||||
"bond-slave",
|
||||
"bridge",
|
||||
"bridge-slave",
|
||||
"dummy",
|
||||
"ethernet",
|
||||
"generic",
|
||||
"gre",
|
||||
"infiniband",
|
||||
"ipip",
|
||||
"sit",
|
||||
"team",
|
||||
"team-slave",
|
||||
"vlan",
|
||||
"vxlan",
|
||||
"wifi",
|
||||
"gsm",
|
||||
"macvlan",
|
||||
"wireguard",
|
||||
"vpn",
|
||||
],
|
||||
),
|
||||
ip4=dict(type="list", elements="str"),
|
||||
gw4=dict(type="str"),
|
||||
gw4_ignore_auto=dict(type="bool", default=False),
|
||||
routes4=dict(type="list", elements="str"),
|
||||
routes4_extended=dict(
|
||||
type="list",
|
||||
elements="dict",
|
||||
options=dict(
|
||||
ip=dict(type="str", required=True),
|
||||
next_hop=dict(type="str"),
|
||||
metric=dict(type="int"),
|
||||
table=dict(type="int"),
|
||||
tos=dict(type="int"),
|
||||
cwnd=dict(type="int"),
|
||||
mtu=dict(type="int"),
|
||||
onlink=dict(type="bool"),
|
||||
),
|
||||
),
|
||||
route_metric4=dict(type="int"),
|
||||
routing_rules4=dict(type="list", elements="str"),
|
||||
never_default4=dict(type="bool", default=False),
|
||||
dns4=dict(type="list", elements="str"),
|
||||
dns4_search=dict(type="list", elements="str"),
|
||||
dns4_options=dict(type="list", elements="str"),
|
||||
dns4_ignore_auto=dict(type="bool", default=False),
|
||||
method4=dict(type="str", choices=["auto", "link-local", "manual", "shared", "disabled"]),
|
||||
may_fail4=dict(type="bool", default=True),
|
||||
dhcp_client_id=dict(type="str"),
|
||||
ip6=dict(type="list", elements="str"),
|
||||
gw6=dict(type="str"),
|
||||
gw6_ignore_auto=dict(type="bool", default=False),
|
||||
dns6=dict(type="list", elements="str"),
|
||||
dns6_search=dict(type="list", elements="str"),
|
||||
dns6_options=dict(type="list", elements="str"),
|
||||
dns6_ignore_auto=dict(type="bool", default=False),
|
||||
routes6=dict(type="list", elements="str"),
|
||||
routes6_extended=dict(
|
||||
type="list",
|
||||
elements="dict",
|
||||
options=dict(
|
||||
ip=dict(type="str", required=True),
|
||||
next_hop=dict(type="str"),
|
||||
metric=dict(type="int"),
|
||||
table=dict(type="int"),
|
||||
cwnd=dict(type="int"),
|
||||
mtu=dict(type="int"),
|
||||
onlink=dict(type="bool"),
|
||||
),
|
||||
),
|
||||
route_metric6=dict(type="int"),
|
||||
method6=dict(type="str", choices=["ignore", "auto", "dhcp", "link-local", "manual", "shared", "disabled"]),
|
||||
ip_privacy6=dict(type="str", choices=["disabled", "prefer-public-addr", "prefer-temp-addr", "unknown"]),
|
||||
addr_gen_mode6=dict(type="str", choices=["default", "default-or-eui64", "eui64", "stable-privacy"]),
|
||||
# Bond Specific vars
|
||||
mode=dict(
|
||||
type="str",
|
||||
default="balance-rr",
|
||||
choices=[
|
||||
"802.3ad",
|
||||
"active-backup",
|
||||
"balance-alb",
|
||||
"balance-rr",
|
||||
"balance-tlb",
|
||||
"balance-xor",
|
||||
"broadcast",
|
||||
],
|
||||
),
|
||||
miimon=dict(type="int"),
|
||||
downdelay=dict(type="int"),
|
||||
updelay=dict(type="int"),
|
||||
xmit_hash_policy=dict(type="str"),
|
||||
fail_over_mac=dict(type="str", choices=["none", "active", "follow"]),
|
||||
arp_interval=dict(type="int"),
|
||||
arp_ip_target=dict(type="str"),
|
||||
primary=dict(type="str"),
|
||||
# general usage
|
||||
mtu=dict(type="int"),
|
||||
mac=dict(type="str"),
|
||||
zone=dict(type="str"),
|
||||
# bridge specific vars
|
||||
stp=dict(type="bool", default=True),
|
||||
priority=dict(type="int", default=128),
|
||||
slavepriority=dict(type="int", default=32),
|
||||
forwarddelay=dict(type="int", default=15),
|
||||
hellotime=dict(type="int", default=2),
|
||||
maxage=dict(type="int", default=20),
|
||||
ageingtime=dict(type="int", default=300),
|
||||
hairpin=dict(type="bool"),
|
||||
path_cost=dict(type="int", default=100),
|
||||
# team specific vars
|
||||
runner=dict(
|
||||
type="str",
|
||||
default="roundrobin",
|
||||
choices=["broadcast", "roundrobin", "activebackup", "loadbalance", "lacp"],
|
||||
),
|
||||
# team active-backup runner specific options
|
||||
runner_hwaddr_policy=dict(type="str", choices=["same_all", "by_active", "only_active"]),
|
||||
# team lacp runner specific options
|
||||
runner_fast_rate=dict(type="bool"),
|
||||
# vlan specific vars
|
||||
vlanid=dict(type="int"),
|
||||
vlandev=dict(type="str"),
|
||||
flags=dict(type="str"),
|
||||
ingress=dict(type="str"),
|
||||
egress=dict(type="str"),
|
||||
# vxlan specific vars
|
||||
vxlan_id=dict(type="int"),
|
||||
vxlan_local=dict(type="str"),
|
||||
vxlan_remote=dict(type="str"),
|
||||
# ip-tunnel specific vars
|
||||
ip_tunnel_dev=dict(type="str"),
|
||||
ip_tunnel_local=dict(type="str"),
|
||||
ip_tunnel_remote=dict(type="str"),
|
||||
# ip-tunnel type gre specific vars
|
||||
ip_tunnel_input_key=dict(type="str", no_log=True),
|
||||
ip_tunnel_output_key=dict(type="str", no_log=True),
|
||||
# 802-11-wireless* specific vars
|
||||
ssid=dict(type="str"),
|
||||
wifi=dict(type="dict"),
|
||||
wifi_sec=dict(type="dict", no_log=True),
|
||||
gsm=dict(type="dict"),
|
||||
macvlan=dict(type="dict"),
|
||||
wireguard=dict(type="dict"),
|
||||
vpn=dict(type="dict"),
|
||||
sriov=dict(type="dict"),
|
||||
# infiniband specific vars
|
||||
transport_mode=dict(type="str", choices=["datagram", "connected"]),
|
||||
infiniband_mac=dict(type="str"),
|
||||
),
|
||||
mutually_exclusive=[
|
||||
["never_default4", "gw4"],
|
||||
["routes4_extended", "routes4"],
|
||||
["routes6_extended", "routes6"],
|
||||
],
|
||||
required_if=[("type", "wifi", [("ssid")])],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
module.run_command_environ_update = dict(LANG="C", LC_ALL="C", LC_MESSAGES="C", LC_CTYPE="C")
|
||||
module = nmcli.create_module()
|
||||
|
||||
nmcli_module = nmcli.Nmcli(module)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue