summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/nxos/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/nxos/tests/unit')
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/compat/__init__.py0
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/compat/mock.py127
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/compat/unittest.py41
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/mock/path.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/mock/procenv.py5
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py15
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py48
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py6
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py8
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py23
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py149
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/utils.py8
57 files changed, 273 insertions, 287 deletions
diff --git a/ansible_collections/cisco/nxos/tests/unit/compat/__init__.py b/ansible_collections/cisco/nxos/tests/unit/compat/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/cisco/nxos/tests/unit/compat/__init__.py
+++ /dev/null
diff --git a/ansible_collections/cisco/nxos/tests/unit/compat/mock.py b/ansible_collections/cisco/nxos/tests/unit/compat/mock.py
deleted file mode 100644
index 50583cd6f..000000000
--- a/ansible_collections/cisco/nxos/tests/unit/compat/mock.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
-# Make coding more python3-ish
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-"""
-Compat module for Python3.x's unittest.mock module
-"""
-import sys
-
-
-# Python 2.7
-
-# Note: Could use the pypi mock library on python3.x as well as python2.x. It
-# is the same as the python3 stdlib mock library
-
-try:
- # Allow wildcard import because we really do want to import all of mock's
- # symbols into this compat shim
- # pylint: disable=wildcard-import,unused-wildcard-import
- from unittest.mock import *
-except ImportError:
- # Python 2
- # pylint: disable=wildcard-import,unused-wildcard-import
- try:
- from mock import *
- except ImportError:
- print("You need the mock library installed on python2.x to run tests")
-
-
-# Prior to 3.4.4, mock_open cannot handle binary read_data
-if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
- file_spec = None
-
- def _iterate_read_data(read_data):
- # Helper for mock_open:
- # Retrieve lines from read_data via a generator so that separate calls to
- # readline, read, and readlines are properly interleaved
- sep = b"\n" if isinstance(read_data, bytes) else "\n"
- data_as_list = [l + sep for l in read_data.split(sep)]
-
- if data_as_list[-1] == sep:
- # If the last line ended in a newline, the list comprehension will have an
- # extra entry that's just a newline. Remove this.
- data_as_list = data_as_list[:-1]
- else:
- # If there wasn't an extra newline by itself, then the file being
- # emulated doesn't have a newline to end the last line remove the
- # newline that our naive format() added
- data_as_list[-1] = data_as_list[-1][:-1]
-
- for line in data_as_list:
- yield line
-
- def mock_open(mock=None, read_data=""):
- """
- A helper function to create a mock to replace the use of `open`. It works
- for `open` called directly or used as a context manager.
-
- The `mock` argument is the mock object to configure. If `None` (the
- default) then a `MagicMock` will be created for you, with the API limited
- to methods or attributes available on standard file handles.
-
- `read_data` is a string for the `read` methoddline`, and `readlines` of the
- file handle to return. This is an empty string by default.
- """
-
- def _readlines_side_effect(*args, **kwargs):
- if handle.readlines.return_value is not None:
- return handle.readlines.return_value
- return list(_data)
-
- def _read_side_effect(*args, **kwargs):
- if handle.read.return_value is not None:
- return handle.read.return_value
- return type(read_data)().join(_data)
-
- def _readline_side_effect():
- if handle.readline.return_value is not None:
- while True:
- yield handle.readline.return_value
- for line in _data:
- yield line
-
- global file_spec
- if file_spec is None:
- import _io
-
- file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
-
- if mock is None:
- mock = MagicMock(name="open", spec=open)
-
- handle = MagicMock(spec=file_spec)
- handle.__enter__.return_value = handle
-
- _data = _iterate_read_data(read_data)
-
- handle.write.return_value = None
- handle.read.return_value = None
- handle.readline.return_value = None
- handle.readlines.return_value = None
-
- handle.read.side_effect = _read_side_effect
- handle.readline.side_effect = _readline_side_effect()
- handle.readlines.side_effect = _readlines_side_effect
-
- mock.return_value = handle
- return mock
diff --git a/ansible_collections/cisco/nxos/tests/unit/compat/unittest.py b/ansible_collections/cisco/nxos/tests/unit/compat/unittest.py
deleted file mode 100644
index df4266ec9..000000000
--- a/ansible_collections/cisco/nxos/tests/unit/compat/unittest.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
-# Make coding more python3-ish
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-"""
-Compat module for Python2.7's unittest module
-"""
-
-import sys
-
-
-# Allow wildcard import because we really do want to import all of
-# unittests's symbols into this compat shim
-# pylint: disable=wildcard-import,unused-wildcard-import
-if sys.version_info < (2, 7):
- try:
- # Need unittest2 on python2.6
- from unittest2 import *
- except ImportError:
- print("You need unittest2 installed on python2.6.x to run tests")
-else:
- from unittest import *
diff --git a/ansible_collections/cisco/nxos/tests/unit/mock/path.py b/ansible_collections/cisco/nxos/tests/unit/mock/path.py
index d15430fde..6053b30f2 100644
--- a/ansible_collections/cisco/nxos/tests/unit/mock/path.py
+++ b/ansible_collections/cisco/nxos/tests/unit/mock/path.py
@@ -2,9 +2,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
-from ansible.utils.path import unfrackpath
+from unittest.mock import MagicMock
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import MagicMock
+from ansible.utils.path import unfrackpath
mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x)
diff --git a/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py b/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py
index e14ad0ece..e6e09464b 100644
--- a/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py
+++ b/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py
@@ -27,12 +27,11 @@ import sys
from contextlib import contextmanager
from io import BytesIO, StringIO
+from unittest import TestCase
from ansible.module_utils._text import to_bytes
from ansible.module_utils.six import PY3
-from ansible_collections.cisco.nxos.tests.unit.compat import unittest
-
@contextmanager
def swap_stdin_and_argv(stdin_data="", argv_data=tuple()):
@@ -78,7 +77,7 @@ def swap_stdout():
sys.stdout = old_stdout
-class ModuleTestCase(unittest.TestCase):
+class ModuleTestCase(TestCase):
def setUp(self, module_args=None):
if module_args is None:
module_args = {
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py
index fd5cdb36f..25f3dfe62 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py
@@ -29,13 +29,14 @@ try:
except ImportError:
from mock import MagicMock
+from unittest import TestCase
+
from ansible.module_utils._text import to_bytes, to_text
from ansible_collections.cisco.nxos.plugins.cliconf import nxos
-from ansible_collections.cisco.nxos.tests.unit.compat import unittest
-class TestPluginCLIConfNXOS(unittest.TestCase):
+class TestPluginCLIConfNXOS(TestCase):
"""Test class for NXOS CLI Conf Methods"""
def setUp(self):
@@ -112,13 +113,19 @@ class TestPluginCLIConfNXOS(unittest.TestCase):
def test_get_command_with_output_nxos(self):
"""Test _get_command_with_output for nxos"""
self._prepare()
- cmd = self._cliconf._get_command_with_output(command="show version", output="json")
+ cmd = self._cliconf._get_command_with_output(
+ command="show version",
+ output="json",
+ )
self.assertEqual(cmd, "show version | json")
def test_get_command_with_output_mds(self):
"""Test _get_command_with_output for mds"""
self._prepare(platform="mds")
- cmd = self._cliconf._get_command_with_output(command="show version", output="json")
+ cmd = self._cliconf._get_command_with_output(
+ command="show version",
+ output="json",
+ )
self.assertEqual(cmd, "show version | json native")
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py
index ae56208fd..0c262d6a3 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_acl_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import set_module_args
from .nxos_module import TestNxosModule
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py
index b7c0e8663..de3595cef 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py
@@ -9,9 +9,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_acls
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import set_module_args
from .nxos_module import TestNxosModule
@@ -475,22 +475,33 @@ class TestNxosAclsModule(TestNxosModule):
self.assertEqual(result["parsed"], compare_list, result["parsed"])
def test_nxos_acls_gathered(self):
+ self.execute_show_command.return_value = dedent(
+ """\
+ ip access-list ACL1v4
+ 10 permit ip any any
+ 20 deny udp any any
+ ip access-list ComplicatedAcl
+ 10 permit tcp any range 1024 65500 192.168.0.0 0.0.0.255 eq 1700
+ ipv6 access-list ACL1v6
+ 10 permit sctp any any
+ """,
+ )
set_module_args(dict(config=[], state="gathered"))
result = self.execute_module(changed=False)
compare_list = [
{
"acls": [
{
+ "name": "ACL1v6",
"aces": [
{
- "destination": {"any": True},
"sequence": 10,
+ "grant": "permit",
"protocol": "sctp",
"source": {"any": True},
- "grant": "permit",
+ "destination": {"any": True},
},
],
- "name": "ACL1v6",
},
],
"afi": "ipv6",
@@ -498,23 +509,42 @@ class TestNxosAclsModule(TestNxosModule):
{
"acls": [
{
+ "name": "ACL1v4",
"aces": [
{
- "destination": {"any": True},
"sequence": 10,
+ "grant": "permit",
"protocol": "ip",
"source": {"any": True},
- "grant": "permit",
+ "destination": {"any": True},
},
{
- "destination": {"any": True},
"sequence": 20,
+ "grant": "deny",
"protocol": "udp",
"source": {"any": True},
- "grant": "deny",
+ "destination": {"any": True},
+ },
+ ],
+ },
+ {
+ "name": "ComplicatedAcl",
+ "aces": [
+ {
+ "sequence": 10,
+ "grant": "permit",
+ "protocol": "tcp",
+ "source": {
+ "any": True,
+ "port_protocol": {"range": {"start": "1024", "end": "65500"}},
+ },
+ "destination": {
+ "address": "192.168.0.0",
+ "wildcard_bits": "0.0.0.255",
+ "port_protocol": {"eq": "1700"},
+ },
},
],
- "name": "ACL1v4",
},
],
"afi": "ipv4",
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py
index c9d564ddb..9f5a63a92 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py
@@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_banner
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py
index e0e48ac7a..1ccc9dacf 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py
@@ -22,6 +22,8 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
# TBD: These imports / import checks are only needed as a workaround for
# shippable, which fails this test due to import yaml & import ordereddict.
import pytest
@@ -30,7 +32,6 @@ from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos impor
nxosCmdRef_import_check,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_bfd_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py
index e40f5fc2e..848788c46 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bfd_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py
index d9c6c2357..10140e776 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_address_family
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -2314,7 +2314,7 @@ class TestNxosBGPAddressFamilyModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_bgp_af_delete(self):
+ def test_nxos_bgp_af_delete_1(self):
# test gathered
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py
index 22c9378eb..acf79b77e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -233,7 +233,7 @@ class TestNxosBgpGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_bgp_global_bfd(self):
+ def test_nxos_bgp_global_bfd_1(self):
run_cfg = dedent(
"""\
router bgp 65536
@@ -1046,7 +1046,7 @@ class TestNxosBgpGlobalModule(TestNxosModule):
result = self.execute_module(changed=False)
self.assertEqual(result["commands"], [])
- def test_nxos_bgp_global_purged(self):
+ def test_nxos_bgp_global_purged_1(self):
run_cfg = dedent(
"""\
router bgp 65001
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py
index b3943f370..0b325d2e8 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_neighbor_address_family
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -868,7 +868,7 @@ class TestNxosBGPNeighborAddressFamilyModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_bgp_nbr_af_originate_peer_as_merged(self):
+ def test_nxos_bgp_nbr_af_originate_peer_as_merged_1(self):
# test merged for default_originate, disable_peer_as_check
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py
index 8d2fd74b5..2eedccaf8 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_templates
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py
index cb7c40ba9..9a0714e9c 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py
@@ -24,8 +24,9 @@ __metaclass__ = type
import json
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_command
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py
index ce5c987c7..be762de23 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py
@@ -22,9 +22,10 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import MagicMock, patch
+
from ansible_collections.cisco.nxos.plugins.cliconf.nxos import Cliconf
from ansible_collections.cisco.nxos.plugins.modules import nxos_config
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import MagicMock, patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py
index 640bcd150..d034a3aaa 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py
@@ -7,10 +7,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
import pytest
from ansible_collections.cisco.nxos.plugins.modules import nxos_devicealias
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import AnsibleFailJson
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py
index c9fa7911e..55e2a4151 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py
@@ -23,8 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_evpn_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py
index 0211a5a31..9b08b6164 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_evpn_vni
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py
index 098a5b7ff..18cef069a 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py
@@ -29,13 +29,13 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.rm_templates.fc_interfaces import (
allowed_port_modes,
allowed_speed_values,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_fc_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py
index 1c79537f1..e98fbce1e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py
@@ -24,8 +24,9 @@ __metaclass__ = type
import json
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_feature
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py
index 732f59e7a..9ddb9e306 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_hostname
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py
index 4ffcc43f3..794ecd896 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_hsrp
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py
index e4f21a825..8bbe79ae4 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_hsrp_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py
index fb8dae234..e0b0b55ce 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -84,7 +84,7 @@ class TestNxosInterfacesModule(TestNxosModule):
self.edit_config.return_value = None
if device == "legacy":
# call execute_module() with device='legacy' to use this codepath
- self.get_platform.return_value = "N3K-Cxxx"
+ self.get_platform.return_value = "N5K-Cxxx"
else:
self.get_platform.return_value = "N9K-Cxxx"
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py
index 289c36ffd..7bb5da30e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py
@@ -23,12 +23,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import PropertyMock, patch
from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.config.l3_interfaces.l3_interfaces import (
L3_interfaces,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_l3_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import PropertyMock, patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py
index e6850278a..3e9c0c64d 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_lacp_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py
index c2acfcc49..c2292a3cb 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_lldp_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import set_module_args
from .nxos_module import TestNxosModule
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py
index aea13fc94..465ea0116 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_logging_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -190,7 +190,7 @@ class TestNxosLoggingGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_logging_global_linear_replaced(self):
+ def test_nxos_logging_global_linear_replaced_1(self):
# test replaced for linear attributes
self.get_config.return_value = dedent(
"""\
@@ -464,7 +464,7 @@ class TestNxosLoggingGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_logging_global_event_merged(self):
+ def test_nxos_logging_global_event_merged_1(self):
# test merged for `event`
self.get_config.return_value = dedent(
"""\
@@ -731,7 +731,7 @@ class TestNxosLoggingGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_logging_global_event_replaced_2(self):
+ def test_nxos_logging_global_event_replaced_3(self):
# test replaced for `event` - 2
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py
index 7c49d8668..d931a357b 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ntp_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -268,7 +268,7 @@ class TestNxosNtpGlobalModule(TestNxosModule):
result = self.execute_module(changed=False)
self.assertEqual(result["commands"], [])
- def test_nxos_ntp_global_complex_merged_idempotent(self):
+ def test_nxos_ntp_global_complex_merged_idempotent_1(self):
# test merged for complex attributes
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py
index 7eb12a21c..12ceeac82 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_nxapi
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py
index f22889574..159086004 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ospf_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py
index 175570499..80234c11a 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ospfv2
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py
index 70a2ae47e..ea8759c20 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ospfv3
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py
index 976aa0964..1368ab240 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_overlay_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py
index eea384836..cb427c967 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_pim
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py
index b746b8b46..9cc7b48ed 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_pim_interface
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py
index f4dbd13ac..a03b78026 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_pim_rp_address
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py
index bdaabe881..e92649b74 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_ping
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py
index d94f0b3e0..f93f9b8f4 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_prefix_lists
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py
index 06d76fe38..d247c02b4 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_route_maps
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py
index 1b7672775..a15562b10 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_snmp_server
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -391,7 +391,7 @@ class TestNxosSnmpServerModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_traps_replaced(self):
+ def test_nxos_snmp_server_traps_replaced_1(self):
# test replaced for traps
self.get_config.return_value = dedent(
"""\
@@ -482,7 +482,7 @@ class TestNxosSnmpServerModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_hosts_merged(self):
+ def test_nxos_snmp_server_hosts_merged_1(self):
# test merged for hosts
self.get_config.return_value = dedent(
"""\
@@ -591,7 +591,7 @@ class TestNxosSnmpServerModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_users_merged(self):
+ def test_nxos_snmp_server_users_merged_1(self):
# test merged for users
self.get_config.return_value = dedent(
"""\
@@ -662,18 +662,19 @@ class TestNxosSnmpServerModule(TestNxosModule):
)
commands = [
"snmp-server user snmp_user_2 network-admin auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv 0x5632724fb8ac3699296af26281e1d0f1"
- " localizedkey engineID 2:2:2:2:2",
+ " localizedV2key engineID 2:2:2:2:2",
"snmp-server user snmp_user_3 network-admin auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128"
- " 0x5632724fb8ac3699296af26281e1d0f1 localizedV2key engineID 3:3:3:3:3",
+ " 0x5632724fb8ac3699296af26281e1d0f1 localizedkey engineID 3:3:3:3:3",
"snmp-server user snmp_user_1 network-admin auth md5 0x5632724fb8ac3699296af26281e1d0f1"
" localizedkey engineID 1:1:1:1:1",
"snmp-server user snmp_user_4 network-admin auth sha-256 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128"
" 0x5632724fb8ac3699296af26281e1d0f1 localizedkey engineID 4:4:4:4:4",
]
result = self.execute_module(changed=True)
+ print(result["commands"])
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_users_merged(self):
+ def test_nxos_snmp_server_users_merged_2(self):
# test merged for users
self.get_config.return_value = dedent(
"""\
@@ -705,7 +706,9 @@ class TestNxosSnmpServerModule(TestNxosModule):
algorithm="md5",
password="0x5632724fb8ac3699296af262",
engine_id="2:2:2:2:2",
- priv=dict(privacy_password="0x5632724fb8ac3699296af262"),
+ priv=dict(
+ privacy_password="0x5632724fb8ac3699296af262",
+ ),
localizedv2_key=True,
),
),
@@ -906,7 +909,9 @@ class TestNxosSnmpServerModule(TestNxosModule):
algorithm="md5",
password="0x7d425fbf09417c44bca69e1d9e9ce889",
localized_key=True,
- priv=dict(privacy_password="0x7d425fbf09417c44bca69e1d9e9ce889"),
+ priv=dict(
+ privacy_password="0x7d425fbf09417c44bca69e1d9e9ce889",
+ ),
),
),
dict(
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py
index 76ed4a3a9..7cd021314 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py
@@ -9,9 +9,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_static_routes
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py
index ea7eec95c..634f69758 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py
@@ -23,8 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_system
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py
index 160804c11..2c8027443 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py
@@ -23,6 +23,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
# TBD: These imports / import checks are only needed as a workaround for
# shippable, which fails this test due to import yaml & import ordereddict.
@@ -32,7 +33,6 @@ from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos impor
nxosCmdRef_import_check,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_telemetry
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import AnsibleFailJson
from .nxos_module import TestNxosModule, load_fixture, set_module_args
@@ -183,7 +183,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_global_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS global config is present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -205,7 +208,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS global config is present
# Change certificate
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -233,7 +239,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS global config is present
# Change interface
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -262,7 +271,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS global config is present
# Change source_interface, vrf and cert
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -314,14 +326,19 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Parameter <id> under <destination_groups> is required" in str(testdata["msg"])
+ assert "Parameter <id> under <destination_groups> is required" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_destgroup_input_validation_2(self):
# Parameter 'destination' is not a dict.
self.execute_show_command.return_value = None
self.get_platform_shortname.return_value = "N9K"
- args = build_args([{"id": "88", "destination": "192.168.1.1"}], "destination_groups")
+ args = build_args(
+ [{"id": "88", "destination": "192.168.1.1"}],
+ "destination_groups",
+ )
set_module_args(args, ignore_provider_arg)
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
@@ -343,7 +360,9 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Playbook entry contains unrecongnized parameters" in str(testdata["msg"])
+ assert "Playbook entry contains unrecongnized parameters" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_destgroup_merged_n9k(self):
@@ -460,7 +479,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS destgroup config is not present.
# Configure only identifier
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -483,7 +505,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS destgroup config is not present.
# Configure only identifier
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args([{"id": "2"}], "destination_groups")
set_module_args(args, ignore_provider_arg)
@@ -492,7 +517,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_destgroup_merged_aggregate_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS destgroup config is present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -523,7 +551,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_destgroup_change_n9k(self):
# TMS destgroup config is not present.
# Change protocol and encoding for dest group 2
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -562,7 +593,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# TMS destgroup config is not present.
# Add destinations to destgroup 10
# Add new destgroup 55 and 56
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -705,7 +739,9 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Parameter <id> under <sensor_groups> is required" in str(testdata["msg"])
+ assert "Parameter <id> under <sensor_groups> is required" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_sensorgroup_input_validation_2(self):
@@ -730,7 +766,9 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Parameter <path> under <sensor_groups> requires <name> key" in str(testdata["msg"])
+ assert "Parameter <path> under <sensor_groups> requires <name> key" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_sensorgroup_resource_key_n9k(self):
@@ -857,7 +895,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_merged_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS sensorgroup config is not present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -880,7 +921,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_quotes_merged_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS sensorgroup config is present with quotes in NX-API path.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K_SGs.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K_SGs.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -906,7 +950,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_vxlan_idempotent_n9k(self):
# TMS sensorgroup config present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[{"id": "56", "data_source": "DME", "path": {"name": "vxlan"}}],
@@ -917,7 +964,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_idempotent_variable1_n9k(self):
# TMS sensorgroup config is present with path key name.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -936,7 +986,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_idempotent_variable2_n9k(self):
# TMS sensorgroup config is present with path key name and depth.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -953,7 +1006,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_idempotent_resource_key_n9k(self):
# TMS sensorgroup config is present resource key only.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args([{"id": "55"}], "sensor_groups")
set_module_args(args, ignore_provider_arg)
@@ -1013,7 +1069,7 @@ class TestNxosTelemetryModule(TestNxosModule):
],
)
- def test_tms_sensorgroup_present_path_interface_n9k(self):
+ def test_tms_sensorgroup_present_path_interface_n9k_1(self):
# TMS sensorgroup config is not present.
# Path name 'resources' test
self.execute_show_command.return_value = None
@@ -1080,7 +1136,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_subscription_merged_idempotent_n9k(self):
# TMS subscription config is not present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -1104,7 +1163,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_subscription_merged_change1_n9k(self):
# TMS subscription config present.
# Change sample interval for sensor group 2
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -1135,7 +1197,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_subscription_add_n9k(self):
# TMS subscription config present.
# Add new destination_group and sensor_group to subscription 5
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -1322,7 +1387,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_telemetry_deleted_input_validation_n9k(self):
# State is 'deleted' and 'config' key present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -1342,14 +1410,19 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Remove config key from playbook when state is <deleted>" in str(testdata["msg"])
+ assert "Remove config key from playbook when state is <deleted>" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_telemetry_deleted_n9k(self):
# Assumes feature telemetry is enabled
# TMS global config is present.
# Make absent with all playbook keys provided
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(dict(state="deleted"), ignore_provider_arg)
self.execute_module(changed=True, commands=["no telemetry"])
@@ -1366,7 +1439,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_replaced1_n9k(self):
# Assumes feature telemetry is enabled
# Modify global config and remove everything else
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -1409,7 +1485,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Modify destination-group 10, add 11 and 99, remove 2
# Modify sensor-group 55, 56
# remove all subscriptions
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
{
@@ -1525,7 +1604,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# remove all other destination-groups
# Modify sensor-group 55 and delete all others
# Modify subscription 7, add 10 and delete all others
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
{
@@ -1616,7 +1698,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# remove all other destination-groups
# Modify sensor-group 55 and delete all others
# Modify subscription 7, add 10 and delete all others
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
{
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py
index c397c82cb..ba0d43756 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_user
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py
index 97870e76d..d686e74fb 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vlans
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py
index a74525e86..5475b52e7 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vpc
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py
index de7ad79bd..4ccb31994 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vpc_interface
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py
index 8f2a2ae1d..e69cdc2aa 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vrf
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py
index bfc2adef8..f104fc295 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vrf_af
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py
index af9ee7ad3..66e04ba79 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py
@@ -7,10 +7,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
import pytest
from ansible_collections.cisco.nxos.plugins.modules import nxos_vsan
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import AnsibleFailJson
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py
index f6862a77e..e30c5c01f 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vxlan_vtep
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py
index c6dc6e8d8..2592b1a6a 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vxlan_vtep_vni
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py
index 6afe78a5b..381eef8a6 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_zone_zoneset
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/utils.py b/ansible_collections/cisco/nxos/tests/unit/modules/utils.py
index cd3b7b05f..87be9cf8e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/utils.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/utils.py
@@ -4,12 +4,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
import json
+from unittest import TestCase
+from unittest.mock import patch
+
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
-from ansible_collections.cisco.nxos.tests.unit.compat import unittest
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
-
def set_module_args(args):
if "_ansible_remote_tmp" not in args:
@@ -40,7 +40,7 @@ def fail_json(*args, **kwargs):
raise AnsibleFailJson(kwargs)
-class ModuleTestCase(unittest.TestCase):
+class ModuleTestCase(TestCase):
def setUp(self):
self.mock_module = patch.multiple(
basic.AnsibleModule,