summaryrefslogtreecommitdiffstats
path: root/ansible_collections/junipernetworks/junos/tests/unit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:18:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:18:41 +0000
commitb643c52cf29ce5bbab738b43290af3556efa1ca9 (patch)
tree21d5c53d7a9b696627a255777cefdf6f78968824 /ansible_collections/junipernetworks/junos/tests/unit
parentReleasing progress-linux version 9.5.1+dfsg-1~progress7.99u1. (diff)
downloadansible-b643c52cf29ce5bbab738b43290af3556efa1ca9.tar.xz
ansible-b643c52cf29ce5bbab738b43290af3556efa1ca9.zip
Merging upstream version 10.0.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/junipernetworks/junos/tests/unit')
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/compat/__init__.py0
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/compat/mock.py130
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/compat/unittest.py41
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/mock/path.py4
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/mock/procenv.py5
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_address_family.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_hostname.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_logging_global.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ntp_global.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py13
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_prefix_lists.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_instances.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_options.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies_global.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_zones.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_snmp_server.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_vlans.py3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py8
33 files changed, 68 insertions, 211 deletions
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/compat/__init__.py b/ansible_collections/junipernetworks/junos/tests/unit/compat/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/junipernetworks/junos/tests/unit/compat/__init__.py
+++ /dev/null
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/compat/mock.py b/ansible_collections/junipernetworks/junos/tests/unit/compat/mock.py
deleted file mode 100644
index 860a9e84b..000000000
--- a/ansible_collections/junipernetworks/junos/tests/unit/compat/mock.py
+++ /dev/null
@@ -1,130 +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
-
-import _io
-
-
-"""
-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:
- 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/junipernetworks/junos/tests/unit/compat/unittest.py b/ansible_collections/junipernetworks/junos/tests/unit/compat/unittest.py
deleted file mode 100644
index df4266ec9..000000000
--- a/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/mock/path.py b/ansible_collections/junipernetworks/junos/tests/unit/mock/path.py
index a7171080e..7d287a5fb 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/mock/path.py
+++ b/ansible_collections/junipernetworks/junos/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.junipernetworks.junos.tests.unit.compat.mock import MagicMock
+from ansible.utils.path import unfrackpath
mock_unfrackpath_noop = MagicMock(
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/mock/procenv.py b/ansible_collections/junipernetworks/junos/tests/unit/mock/procenv.py
index 79f2f97ca..e6e09464b 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/mock/procenv.py
+++ b/ansible_collections/junipernetworks/junos/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.junipernetworks.junos.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/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_address_family.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_address_family.py
index f28cb61a0..5a743bee7 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_address_family.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_address_family.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_bgp_address_family
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py
index f1d377494..f5d8dfcd5 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_bgp_global
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py
index 720b32981..5e0669577 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py
@@ -26,8 +26,9 @@ try:
except ImportError:
from xml.etree.ElementTree import fromstring
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_command
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py
index f3adb4767..e24a56c47 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py
@@ -22,10 +22,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible.module_utils._text import to_text
from ansible_collections.junipernetworks.junos.plugins.modules import junos_config
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py
index 1e6bc12d3..154ea4f50 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py
@@ -26,8 +26,9 @@ try:
except ImportError:
from xml.etree.ElementTree import fromstring
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_facts
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_hostname.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_hostname.py
index a6c40395f..8fe1931d7 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_hostname.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_hostname.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_hostname
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py
index 55ee8c766..d2f41bf6c 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_interfaces
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py
index 1524047f5..06d61143e 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_l2_interfaces
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py
index dba2e4b7d..600861a68 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_l3_interfaces
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_logging_global.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_logging_global.py
index d1046c14c..55ac5170a 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_logging_global.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_logging_global.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_logging_global
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py
index 8f98536c7..70e4fe0b2 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py
@@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_netconf
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ntp_global.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ntp_global.py
index d99faf11a..26836a7c4 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ntp_global.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ntp_global.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_ntp_global
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py
index e57a65955..39ea2b77d 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import MagicMock, patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_ospf_interfaces
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import MagicMock, patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py
index 593acd831..3ec9f589c 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_ospfv2
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
@@ -567,7 +568,7 @@ class TestJunosOspfv2Module(TestJunosModule):
result = self.execute_module(changed=True, commands=commands)
self.assertEqual(sorted(result["commands"]), sorted(commands))
- def test_junos_ospfv2_rendered(self):
+ def test_junos_ospfv2_deleted(self):
set_module_args(
dict(
config=[],
@@ -576,11 +577,13 @@ class TestJunosOspfv2Module(TestJunosModule):
)
commands = [
'<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><nc:ospf>'
- '<nc:area delete="delete">0.0.0.100</nc:area><nc:spf-options delete="delete"/>'
- '<nc:reference-bandwidth delete="delete"/><nc:no-rfc-1583 delete="delete"/>'
- '<nc:overload delete="delete"/></nc:ospf></nc:protocols>',
+ '<nc:area delete="delete">0.0.0.100</nc:area><nc:area delete="delete">0.0.0.200</nc:area>'
+ '<nc:spf-options delete="delete"/><nc:reference-bandwidth delete="delete"/>'
+ '<nc:no-rfc-1583 delete="delete"/><nc:overload delete="delete"/>'
+ '<nc:prefix-export-limit delete="delete"/></nc:ospf></nc:protocols>',
]
result = self.execute_module(changed=True, commands=commands)
+
self.assertEqual(sorted(result["commands"]), sorted(commands))
def test_junos_ospfv2_parsed(self):
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py
index a96d95bac..beef248b3 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import MagicMock, patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_ospfv3
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import MagicMock, patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py
index f679fa5a3..943c7e9e0 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py
@@ -21,7 +21,8 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import MagicMock, patch
+from unittest.mock import MagicMock, patch
+
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py
index da101d418..4a6d27011 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py
@@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import MagicMock, patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_ping
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import MagicMock, patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_prefix_lists.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_prefix_lists.py
index d46b38684..9db905a4c 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_prefix_lists.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_prefix_lists.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_prefix_lists
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_instances.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_instances.py
index 5d656852d..214bddb80 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_instances.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_instances.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_routing_instances
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_options.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_options.py
index 2f80838b0..0f506bc8c 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_options.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_routing_options.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_routing_options
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py
index 4c914aa3d..11a3bb8a2 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py
@@ -26,8 +26,9 @@ try:
except ImportError:
from xml.etree.ElementTree import fromstring
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_rpc
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py
index 0788d6523..fc2bd1b82 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py
@@ -23,7 +23,8 @@ __metaclass__ = type
import os
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import MagicMock, patch
+from unittest.mock import MagicMock, patch
+
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies.py
index b41161672..22eb2b14c 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_security_policies
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies_global.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies_global.py
index 1dd375233..1c1131d90 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies_global.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_policies_global.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_security_policies_global
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_zones.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_zones.py
index 764d1a7e8..b5eb03851 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_zones.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_security_zones.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_security_zones
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_snmp_server.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_snmp_server.py
index ed73b8c5a..f29381a19 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_snmp_server.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_snmp_server.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_snmp_server
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_vlans.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_vlans.py
index c6f33fc12..1f0890a51 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_vlans.py
+++ b/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_vlans.py
@@ -26,8 +26,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.junipernetworks.junos.plugins.modules import junos_vlans
-from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import patch
from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import set_module_args
from .junos_module import TestJunosModule, load_fixture
diff --git a/ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py b/ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py
index d1cc4ec53..87be9cf8e 100644
--- a/ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py
+++ b/ansible_collections/junipernetworks/junos/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.junipernetworks.junos.tests.unit.compat import unittest
-from ansible_collections.junipernetworks.junos.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,