From ddd53d98498951945828eb4325c3a7cb61cb7f63 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 05:14:18 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/unit/mock/path.py | 3 +- .../network/ios/test_ios_acl_interfaces.py | 7 ++-- .../unit/modules/network/ios/test_ios_acls.py | 11 ++---- .../modules/network/ios/test_ios_banner.py | 2 +- .../ios/test_ios_bgp_address_family.py | 34 +++++++++--------- .../network/ios/test_ios_bgp_global.py | 11 ++---- .../modules/network/ios/test_ios_command.py | 3 +- .../modules/network/ios/test_ios_config.py | 19 ++++++---- .../network/ios/test_ios_evpn_global.py | 6 ++-- .../modules/network/ios/test_ios_facts.py | 36 ++++++++----------- .../modules/network/ios/test_ios_hostname.py | 7 ++-- .../network/ios/test_ios_interfaces.py | 7 ++-- .../network/ios/test_ios_l2_interfaces.py | 20 ++++++----- .../network/ios/test_ios_l3_interfaces.py | 6 ++-- .../unit/modules/network/ios/test_ios_lacp.py | 11 ++---- .../network/ios/test_ios_lacp_interfaces.py | 10 ++---- .../network/ios/test_ios_lag_interfaces.py | 6 ++-- .../network/ios/test_ios_lldp_global.py | 10 ++---- .../network/ios/test_ios_lldp_inteface.py | 10 ++---- .../network/ios/test_ios_logging_global.py | 14 ++++---- .../unit/modules/network/ios/test_ios_ntp.py | 1 + .../network/ios/test_ios_ntp_global.py | 34 ++++++++++++------ .../network/ios/test_ios_ospf_interfaces.py | 6 ++-- .../modules/network/ios/test_ios_ospfv2.py | 9 +++-- .../modules/network/ios/test_ios_ospfv3.py | 21 +++++------ .../unit/modules/network/ios/test_ios_ping.py | 4 +-- .../network/ios/test_ios_prefix_lists.py | 5 ++- .../network/ios/test_ios_route_maps.py | 16 +++++---- .../modules/network/ios/test_ios_service.py | 6 ++-- .../network/ios/test_ios_snmp_server.py | 8 ++--- .../network/ios/test_ios_static_routes.py | 10 +++--- .../modules/network/ios/test_ios_system.py | 3 +- .../unit/modules/network/ios/test_ios_user.py | 16 +++++---- .../modules/network/ios/test_ios_vlans.py | 6 ++-- .../unit/modules/network/ios/test_ios_vrf.py | 9 +++-- .../network/ios/test_ios_vxlan_vtep.py | 6 ++-- 36 files changed, 182 insertions(+), 211 deletions(-) diff --git a/tests/unit/mock/path.py b/tests/unit/mock/path.py index 49b5f854a..7d287a5fb 100644 --- a/tests/unit/mock/path.py +++ b/tests/unit/mock/path.py @@ -8,5 +8,6 @@ mock_unfrackpath_noop = MagicMock( - spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x + spec_set=unfrackpath, + side_effect=lambda x, *args, **kwargs: x, ) diff --git a/tests/unit/modules/network/ios/test_ios_acl_interfaces.py b/tests/unit/modules/network/ios/test_ios_acl_interfaces.py index a0aa41e1b..3c8567797 100644 --- a/tests/unit/modules/network/ios/test_ios_acl_interfaces.py +++ b/tests/unit/modules/network/ios/test_ios_acl_interfaces.py @@ -7,11 +7,10 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_acl_interfaces - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule @@ -27,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.acl_interfaces.acl_interfaces." diff --git a/tests/unit/modules/network/ios/test_ios_acls.py b/tests/unit/modules/network/ios/test_ios_acls.py index c0a374cb0..36d96365a 100644 --- a/tests/unit/modules/network/ios/test_ios_acls.py +++ b/tests/unit/modules/network/ios/test_ios_acls.py @@ -7,11 +7,10 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_acls - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule @@ -27,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.acls.acls." @@ -40,9 +37,7 @@ def setUp(self): "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.acls.acls." "AclsFacts.get_acl_names", ) - self.execute_show_command_name = ( - self.mock_execute_show_command_name_specific.start() - ) + self.execute_show_command_name = self.mock_execute_show_command_name_specific.start() def tearDown(self): super(TestIosAclsModule, self).tearDown() diff --git a/tests/unit/modules/network/ios/test_ios_banner.py b/tests/unit/modules/network/ios/test_ios_banner.py index bdb2a9258..b114d1817 100644 --- a/tests/unit/modules/network/ios/test_ios_banner.py +++ b/tests/unit/modules/network/ios/test_ios_banner.py @@ -19,8 +19,8 @@ __metaclass__ = type from unittest.mock import patch -from ansible_collections.cisco.ios.plugins.modules import ios_banner +from ansible_collections.cisco.ios.plugins.modules import ios_banner from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule, load_fixture diff --git a/tests/unit/modules/network/ios/test_ios_bgp_address_family.py b/tests/unit/modules/network/ios/test_ios_bgp_address_family.py index 3033ac118..ea5d279f4 100644 --- a/tests/unit/modules/network/ios/test_ios_bgp_address_family.py +++ b/tests/unit/modules/network/ios/test_ios_bgp_address_family.py @@ -7,11 +7,10 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_bgp_address_family - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule @@ -27,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.bgp_address_family.bgp_address_family." @@ -122,10 +119,10 @@ def test_ios_bgp_address_family_merged(self): neighbor_address="198.51.100.1", remote_as="65.11", route_maps=[ - dict(name="test-route-out", out="true") + dict(name="test-route-out", out="true"), ], prefix_lists=[ - dict(name="AS65100-PREFIX-OUT", out="true") + dict(name="AS65100-PREFIX-OUT", out="true"), ], ), ], @@ -135,7 +132,7 @@ def test_ios_bgp_address_family_merged(self): bgp=dict(aggregate_timer=20, dmzlink_bw=True, scan_time=10), default_metric=10, networks=[ - dict(address="192.0.1.1", route_map="test_route") + dict(address="192.0.1.1", route_map="test_route"), ], ), ], @@ -336,13 +333,13 @@ def test_ios_bgp_address_family_merged_idempotent(self): "neighbor_address": "198.51.100.1", "nexthop_self": {"all": True}, "prefix_lists": [ - {"name": "AS65100-PREFIX-OUT", "out": True} + {"name": "AS65100-PREFIX-OUT", "out": True}, ], "remote_as": 10, "route_maps": [{"name": "test-out", "out": True}], "route_server_client": True, "slow_peer_options": { - "detection": {"threshold": 150} + "detection": {"threshold": 150}, }, }, ], @@ -442,7 +439,7 @@ def test_ios_bgp_address_family_replaced(self): activate=True, remote_as=200, route_maps=[ - dict(name="test-replaced-route", out=True) + dict(name="test-replaced-route", out=True), ], ), ], @@ -552,14 +549,15 @@ def test_ios_bgp_address_family_replaced_idempotent(self): cost_community=dict( id=100, poi=dict( - igp_cost=True, transitive=True + igp_cost=True, + transitive=True, ), ), ), ), nexthop_self=dict(all=True), prefix_lists=[ - dict(name="AS65100-PREFIX-OUT", out="true") + dict(name="AS65100-PREFIX-OUT", out="true"), ], slow_peer=[dict(detection=dict(threshold=150))], remote_as=10, @@ -731,14 +729,15 @@ def test_ios_bgp_address_family_overridden_idempotent(self): cost_community=dict( id=100, poi=dict( - igp_cost=True, transitive=True + igp_cost=True, + transitive=True, ), ), ), ), nexthop_self=dict(all=True), prefix_lists=[ - dict(name="AS65100-PREFIX-OUT", out="true") + dict(name="AS65100-PREFIX-OUT", out="true"), ], slow_peer=[dict(detection=dict(threshold=150))], remote_as=10, @@ -963,7 +962,8 @@ def test_ios_bgp_address_family_rendered(self): cost_community=dict( id=100, poi=dict( - igp_cost=True, transitive=True + igp_cost=True, + transitive=True, ), ), ), @@ -1209,7 +1209,7 @@ def test_ios_bgp_address_family_parsed(self): }, "route_server_client": True, "prefix_lists": [ - {"name": "AS65100-PREFIX-OUT", "out": True} + {"name": "AS65100-PREFIX-OUT", "out": True}, ], "slow_peer_options": {"detection": {"threshold": 150}}, "route_maps": [{"name": "test-out", "out": True}], diff --git a/tests/unit/modules/network/ios/test_ios_bgp_global.py b/tests/unit/modules/network/ios/test_ios_bgp_global.py index a74413ccb..16a4c9b5c 100644 --- a/tests/unit/modules/network/ios/test_ios_bgp_global.py +++ b/tests/unit/modules/network/ios/test_ios_bgp_global.py @@ -7,14 +7,11 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_bgp_global -from ansible_collections.cisco.ios.tests.unit.modules.utils import ( - AnsibleFailJson, - set_module_args, -) +from ansible_collections.cisco.ios.tests.unit.modules.utils import AnsibleFailJson, set_module_args from .ios_module import TestIosModule @@ -29,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.bgp_global.bgp_global." diff --git a/tests/unit/modules/network/ios/test_ios_command.py b/tests/unit/modules/network/ios/test_ios_command.py index 24b2aeb41..69788ef3e 100644 --- a/tests/unit/modules/network/ios/test_ios_command.py +++ b/tests/unit/modules/network/ios/test_ios_command.py @@ -20,9 +20,10 @@ __metaclass__ = type -from unittest.mock import patch import json +from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_command from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args diff --git a/tests/unit/modules/network/ios/test_ios_config.py b/tests/unit/modules/network/ios/test_ios_config.py index fd4ddd1a3..7fa3931d0 100644 --- a/tests/unit/modules/network/ios/test_ios_config.py +++ b/tests/unit/modules/network/ios/test_ios_config.py @@ -22,9 +22,9 @@ __metaclass__ = type from unittest.mock import MagicMock, patch + from ansible_collections.cisco.ios.plugins.cliconf.ios import Cliconf from ansible_collections.cisco.ios.plugins.modules import ios_config - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule, load_fixture @@ -124,7 +124,8 @@ def test_ios_config_lines_wo_parents(self): set_module_args(dict(lines=lines)) self.conn.get_diff = MagicMock( return_value=self.cliconf_obj.get_diff( - "\n".join(lines), self.running_config + "\n".join(lines), + self.running_config, ), ) commands = ["hostname foo"] @@ -140,7 +141,8 @@ def test_ios_config_lines_w_parents(self): self.conn.get_diff = MagicMock( return_value=self.cliconf_obj.get_diff( - candidate_config, self.running_config + candidate_config, + self.running_config, ), ) @@ -152,7 +154,8 @@ def test_ios_config_before(self): set_module_args(dict(lines=lines, before=["test1", "test2"])) self.conn.get_diff = MagicMock( return_value=self.cliconf_obj.get_diff( - "\n".join(lines), self.running_config + "\n".join(lines), + self.running_config, ), ) commands = ["test1", "test2", "hostname foo"] @@ -163,7 +166,8 @@ def test_ios_config_after(self): set_module_args(dict(lines=lines, after=["test1", "test2"])) self.conn.get_diff = MagicMock( return_value=self.cliconf_obj.get_diff( - "\n".join(lines), self.running_config + "\n".join(lines), + self.running_config, ), ) commands = ["hostname foo", "test1", "test2"] @@ -172,11 +176,12 @@ def test_ios_config_after(self): def test_ios_config_before_after_no_change(self): lines = ["hostname router"] set_module_args( - dict(lines=lines, before=["test1", "test2"], after=["test3", "test4"]) + dict(lines=lines, before=["test1", "test2"], after=["test3", "test4"]), ) self.conn.get_diff = MagicMock( return_value=self.cliconf_obj.get_diff( - "\n".join(lines), self.running_config + "\n".join(lines), + self.running_config, ), ) self.execute_module() diff --git a/tests/unit/modules/network/ios/test_ios_evpn_global.py b/tests/unit/modules/network/ios/test_ios_evpn_global.py index 0ed0c93d3..76f467411 100644 --- a/tests/unit/modules/network/ios/test_ios_evpn_global.py +++ b/tests/unit/modules/network/ios/test_ios_evpn_global.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_evpn_global from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.evpn_global.evpn_global." diff --git a/tests/unit/modules/network/ios/test_ios_facts.py b/tests/unit/modules/network/ios/test_ios_facts.py index ec4ae08ea..4878d4ad7 100644 --- a/tests/unit/modules/network/ios/test_ios_facts.py +++ b/tests/unit/modules/network/ios/test_ios_facts.py @@ -20,10 +20,10 @@ __metaclass__ = type from unittest.mock import patch + from ansible.module_utils.six import assertCountEqual from ansible_collections.cisco.ios.plugins.modules import ios_facts - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule, load_fixture @@ -81,10 +81,12 @@ def test_ios_facts_stacked(self): result = self.execute_module() self.assertEqual(result["ansible_facts"]["ansible_net_model"], "WS-C3750-24TS") self.assertEqual( - result["ansible_facts"]["ansible_net_serialnum"], "CAT0726R0ZU" + result["ansible_facts"]["ansible_net_serialnum"], + "CAT0726R0ZU", ) self.assertEqual( - result["ansible_facts"]["ansible_net_operatingmode"], "autonomous" + result["ansible_facts"]["ansible_net_operatingmode"], + "autonomous", ) self.assertEqual( result["ansible_facts"]["ansible_net_stacked_models"], @@ -99,38 +101,30 @@ def test_ios_facts_tunnel_address_and_lineprotocol(self): set_module_args(dict(gather_subset="interfaces")) result = self.execute_module() self.assertEqual( - result["ansible_facts"]["ansible_net_interfaces"][ - "GigabitEthernet0/0/0.1012" - ]["macaddress"], + result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet0/0/0.1012"][ + "macaddress" + ], "5e00.0003.0000", ) self.assertEqual( - result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet0/0"][ - "macaddress" - ], + result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet0/0"]["macaddress"], "5e00.0008.0000", ) self.assertEqual( - result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet1"][ - "macaddress" - ], + result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet1"]["macaddress"], "5e00.0006.0000", ) self.assertIsNone( - result["ansible_facts"]["ansible_net_interfaces"]["Tunnel1110"][ - "macaddress" - ], + result["ansible_facts"]["ansible_net_interfaces"]["Tunnel1110"]["macaddress"], ) self.assertEqual( - result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet1"][ - "lineprotocol" - ], + result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet1"]["lineprotocol"], "up", ) self.assertEqual( - result["ansible_facts"]["ansible_net_interfaces"][ - "TenGigabitEthernet2/5/5" - ]["lineprotocol"], + result["ansible_facts"]["ansible_net_interfaces"]["TenGigabitEthernet2/5/5"][ + "lineprotocol" + ], "down", ) diff --git a/tests/unit/modules/network/ios/test_ios_hostname.py b/tests/unit/modules/network/ios/test_ios_hostname.py index 081a542ff..359cf562a 100644 --- a/tests/unit/modules/network/ios/test_ios_hostname.py +++ b/tests/unit/modules/network/ios/test_ios_hostname.py @@ -7,11 +7,10 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_hostname - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule @@ -27,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.hostname.hostname." diff --git a/tests/unit/modules/network/ios/test_ios_interfaces.py b/tests/unit/modules/network/ios/test_ios_interfaces.py index f9964b985..63ee2341b 100644 --- a/tests/unit/modules/network/ios/test_ios_interfaces.py +++ b/tests/unit/modules/network/ios/test_ios_interfaces.py @@ -7,11 +7,10 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_interfaces - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule @@ -27,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.interfaces.interfaces." diff --git a/tests/unit/modules/network/ios/test_ios_l2_interfaces.py b/tests/unit/modules/network/ios/test_ios_l2_interfaces.py index 9b56c2c52..e84846aeb 100644 --- a/tests/unit/modules/network/ios/test_ios_l2_interfaces.py +++ b/tests/unit/modules/network/ios/test_ios_l2_interfaces.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_l2_interfaces from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.l2_interfaces.l2_interfaces." @@ -138,7 +136,9 @@ def test_ios_l2_interfaces_merged_idempotent(self): dict( config=[ dict( - access=dict(vlan=10), mode="access", name="GigabitEthernet0/1" + access=dict(vlan=10), + mode="access", + name="GigabitEthernet0/1", ), dict( mode="trunk", @@ -274,7 +274,9 @@ def test_ios_l2_interfaces_replaced_idempotent(self): dict( config=[ dict( - access=dict(vlan=10), mode="access", name="GigabitEthernet0/1" + access=dict(vlan=10), + mode="access", + name="GigabitEthernet0/1", ), dict( mode="trunk", @@ -426,7 +428,9 @@ def test_ios_l2_interfaces_overridden_idempotent(self): dict( config=[ dict( - access=dict(vlan=10), mode="access", name="GigabitEthernet0/1" + access=dict(vlan=10), + mode="access", + name="GigabitEthernet0/1", ), dict( mode="trunk", @@ -719,7 +723,7 @@ def test_ios_l2_interfaces_merged_mode_change(self): access=dict(vlan=20), mode="trunk", name="TwoGigabitEthernet1/0/1", - ) + ), ], state="merged", ), diff --git a/tests/unit/modules/network/ios/test_ios_l3_interfaces.py b/tests/unit/modules/network/ios/test_ios_l3_interfaces.py index 821bd02ea..3e3cc038b 100644 --- a/tests/unit/modules/network/ios/test_ios_l3_interfaces.py +++ b/tests/unit/modules/network/ios/test_ios_l3_interfaces.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_l3_interfaces from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.l3_interfaces.l3_interfaces." diff --git a/tests/unit/modules/network/ios/test_ios_lacp.py b/tests/unit/modules/network/ios/test_ios_lacp.py index 2314e273a..f4460162a 100644 --- a/tests/unit/modules/network/ios/test_ios_lacp.py +++ b/tests/unit/modules/network/ios/test_ios_lacp.py @@ -7,11 +7,10 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_lacp - from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args from .ios_module import TestIosModule @@ -37,17 +36,13 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." "get_resource_connection", ) - self.get_resource_connection_config = ( - self.mock_get_resource_connection_config.start() - ) + self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_edit_config = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config", diff --git a/tests/unit/modules/network/ios/test_ios_lacp_interfaces.py b/tests/unit/modules/network/ios/test_ios_lacp_interfaces.py index 061e71af1..817c6869c 100644 --- a/tests/unit/modules/network/ios/test_ios_lacp_interfaces.py +++ b/tests/unit/modules/network/ios/test_ios_lacp_interfaces.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_lacp_interfaces from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -36,17 +36,13 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." "get_resource_connection", ) - self.get_resource_connection_config = ( - self.mock_get_resource_connection_config.start() - ) + self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_edit_config = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config", diff --git a/tests/unit/modules/network/ios/test_ios_lag_interfaces.py b/tests/unit/modules/network/ios/test_ios_lag_interfaces.py index 742553cf4..71d6ff933 100644 --- a/tests/unit/modules/network/ios/test_ios_lag_interfaces.py +++ b/tests/unit/modules/network/ios/test_ios_lag_interfaces.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_lag_interfaces from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.lag_interfaces.lag_interfaces." diff --git a/tests/unit/modules/network/ios/test_ios_lldp_global.py b/tests/unit/modules/network/ios/test_ios_lldp_global.py index 88b0cf476..2c5eb1c40 100644 --- a/tests/unit/modules/network/ios/test_ios_lldp_global.py +++ b/tests/unit/modules/network/ios/test_ios_lldp_global.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_lldp_global from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -36,17 +36,13 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." "get_resource_connection", ) - self.get_resource_connection_config = ( - self.mock_get_resource_connection_config.start() - ) + self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_edit_config = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config", diff --git a/tests/unit/modules/network/ios/test_ios_lldp_inteface.py b/tests/unit/modules/network/ios/test_ios_lldp_inteface.py index a778d3ecb..04a25993a 100644 --- a/tests/unit/modules/network/ios/test_ios_lldp_inteface.py +++ b/tests/unit/modules/network/ios/test_ios_lldp_inteface.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_lldp_interfaces from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -36,17 +36,13 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." "get_resource_connection", ) - self.get_resource_connection_config = ( - self.mock_get_resource_connection_config.start() - ) + self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_edit_config = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.providers.CliProvider.edit_config", diff --git a/tests/unit/modules/network/ios/test_ios_logging_global.py b/tests/unit/modules/network/ios/test_ios_logging_global.py index 5aefeb2b7..f1b3eada3 100644 --- a/tests/unit/modules/network/ios/test_ios_logging_global.py +++ b/tests/unit/modules/network/ios/test_ios_logging_global.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_logging_global from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.logging_global.logging_global." @@ -434,7 +432,7 @@ def test_ios_logging_global_merged(self): ipv6="2001:0db8:85a3:0000:0000:8a2e:0370:7374", vrf="Apn2", transport=dict( - udp=dict(discriminator="msglog01 severity includes 5") + udp=dict(discriminator="msglog01 severity includes 5"), ), ), dict( @@ -533,7 +531,7 @@ def test_ios_logging_global_gathered_host(self): hostname="172.16.1.1", vrf="vpn-1", transport=dict(tcp=dict(audit=True)), - ) + ), ], ) result = self.execute_module(changed=False) @@ -643,7 +641,7 @@ def test_ios_logging_global_replaced(self): ) playbook = dict( config=dict( - hosts=[dict(hostname="172.16.2.15", session_id=dict(text="Test"))] + hosts=[dict(hostname="172.16.2.15", session_id=dict(text="Test"))], ), ) replaced = [ @@ -687,7 +685,7 @@ def test_ios_logging_global_replaced_ordering_host(self): "size": 10, }, "source_interface": [ - {"interface": "GigabitEthernet0", "vrf": "Mgmt-intf"} + {"interface": "GigabitEthernet0", "vrf": "Mgmt-intf"}, ], "trap": "informational", }, diff --git a/tests/unit/modules/network/ios/test_ios_ntp.py b/tests/unit/modules/network/ios/test_ios_ntp.py index b4102cdb7..fe11b77b7 100644 --- a/tests/unit/modules/network/ios/test_ios_ntp.py +++ b/tests/unit/modules/network/ios/test_ios_ntp.py @@ -19,6 +19,7 @@ __metaclass__ = type from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_ntp from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args diff --git a/tests/unit/modules/network/ios/test_ios_ntp_global.py b/tests/unit/modules/network/ios/test_ios_ntp_global.py index 3e04b0a2a..e955c2929 100644 --- a/tests/unit/modules/network/ios/test_ios_ntp_global.py +++ b/tests/unit/modules/network/ios/test_ios_ntp_global.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_ntp_global from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.ntp_global.ntp_global." @@ -112,7 +110,9 @@ def test_ios_ntp_global_merged_idempotent(self): version=2, ), dict( - peer="checkPeerDomainIpv4.com", prefer=True, use_ipv4=True + peer="checkPeerDomainIpv4.com", + prefer=True, + use_ipv4=True, ), dict(peer="checkPeerDomainIpv6.com", use_ipv6=True), dict(peer="testPeerDomainIpv6.com", prefer=True, use_ipv6=True), @@ -173,10 +173,16 @@ def test_ios_ntp_global_merged(self): peers=[ dict(peer="172.16.1.10", version=2), dict( - key=2, minpoll=5, peer="172.16.1.11", prefer=True, version=2 + key=2, + minpoll=5, + peer="172.16.1.11", + prefer=True, + version=2, ), dict( - peer="checkPeerDomainIpv4.com", prefer=True, use_ipv4=True + peer="checkPeerDomainIpv4.com", + prefer=True, + use_ipv4=True, ), dict(peer="checkPeerDomainIpv6.com", use_ipv6=True), dict(peer="testPeerDomainIpv6.com", prefer=True, use_ipv6=True), @@ -371,10 +377,16 @@ def test_ios_ntp_global_replaced_overridden(self): peers=[ dict(peer="172.16.1.10", version=2), dict( - key=2, minpoll=5, peer="172.16.1.11", prefer=True, version=2 + key=2, + minpoll=5, + peer="172.16.1.11", + prefer=True, + version=2, ), dict( - peer="checkPeerDomainIpv4.com", prefer=True, use_ipv4=True + peer="checkPeerDomainIpv4.com", + prefer=True, + use_ipv4=True, ), dict(peer="checkPeerDomainIpv6.com", use_ipv6=True), dict(peer="testPeerDomainIpv6.com", prefer=True, use_ipv6=True), @@ -480,7 +492,9 @@ def test_ios_ntp_global_replaced_overridden_idempotent(self): version=2, ), dict( - peer="checkPeerDomainIpv4.com", prefer=True, use_ipv4=True + peer="checkPeerDomainIpv4.com", + prefer=True, + use_ipv4=True, ), ], servers=[ diff --git a/tests/unit/modules/network/ios/test_ios_ospf_interfaces.py b/tests/unit/modules/network/ios/test_ios_ospf_interfaces.py index 26ccf6d5c..ea500f540 100644 --- a/tests/unit/modules/network/ios/test_ios_ospf_interfaces.py +++ b/tests/unit/modules/network/ios/test_ios_ospf_interfaces.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_ospf_interfaces from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.ospf_interfaces.ospf_interfaces." diff --git a/tests/unit/modules/network/ios/test_ios_ospfv2.py b/tests/unit/modules/network/ios/test_ios_ospfv2.py index 922f0d014..e14def8d8 100644 --- a/tests/unit/modules/network/ios/test_ios_ospfv2.py +++ b/tests/unit/modules/network/ios/test_ios_ospfv2.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_ospfv2 from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.ospfv2.ospfv2." @@ -92,7 +90,8 @@ def test_ios_ospfv2_merged(self): max_metric=dict(on_startup=dict(time=100), router_lsa=True), passive_interfaces=dict( interface=dict( - set_interface=False, name=["GigabitEthernet0/2"] + set_interface=False, + name=["GigabitEthernet0/2"], ), ), vrf="blue", diff --git a/tests/unit/modules/network/ios/test_ios_ospfv3.py b/tests/unit/modules/network/ios/test_ios_ospfv3.py index 1f0ba626c..efaae19ac 100644 --- a/tests/unit/modules/network/ios/test_ios_ospfv3.py +++ b/tests/unit/modules/network/ios/test_ios_ospfv3.py @@ -8,6 +8,7 @@ __metaclass__ = type from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_ospfv3 from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -24,9 +25,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.ospfv3.ospfv3." @@ -60,7 +59,8 @@ def test_ios_ospfv3_merged(self): unicast=True, vrf="blue", adjacency=dict( - min_adjacency=100, max_adjacency=100 + min_adjacency=100, + max_adjacency=100, ), ), ], @@ -93,7 +93,7 @@ def test_ios_ospfv3_merged_idempotent(self): dict( area_id=10, nssa=dict( - default_information_originate=dict(metric=10) + default_information_originate=dict(metric=10), ), ), ], @@ -138,7 +138,8 @@ def test_ios_ospfv3_replaced(self): unicast=True, vrf="blue", adjacency=dict( - min_adjacency=100, max_adjacency=100 + min_adjacency=100, + max_adjacency=100, ), ), ], @@ -172,7 +173,7 @@ def test_ios_ospfv3_replaced_idempotent(self): dict( area_id=10, nssa=dict( - default_information_originate=dict(metric=10) + default_information_originate=dict(metric=10), ), ), ], @@ -215,7 +216,7 @@ def test_ios_ospfv3_overridden(self): dict( area_id=10, nssa=dict( - default_information_originate=dict(metric=10) + default_information_originate=dict(metric=10), ), ), ], @@ -268,7 +269,7 @@ def test_ios_ospfv3_overridden_idempotent(self): dict( area_id=10, nssa=dict( - default_information_originate=dict(metric=10) + default_information_originate=dict(metric=10), ), ), ], @@ -301,7 +302,7 @@ def test_ios_ospfv3_overridden_idempotent(self): def test_ios_ospfv3_deleted(self): set_module_args( - dict(config=dict(processes=[dict(process_id="1")]), state="deleted") + dict(config=dict(processes=[dict(process_id="1")]), state="deleted"), ) commands = ["no router ospfv3 1"] self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/modules/network/ios/test_ios_ping.py b/tests/unit/modules/network/ios/test_ios_ping.py index f10694f97..02969ffe0 100644 --- a/tests/unit/modules/network/ios/test_ios_ping.py +++ b/tests/unit/modules/network/ios/test_ios_ping.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_ping from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -61,7 +61,7 @@ def test_ios_ping_v6(self): """, ) set_module_args( - dict(count=2, dest="2001:db8:ffff:ffff:ffff:ffff:ffff:ffff", afi="ipv6") + dict(count=2, dest="2001:db8:ffff:ffff:ffff:ffff:ffff:ffff", afi="ipv6"), ) result = self.execute_module() mock_res = { diff --git a/tests/unit/modules/network/ios/test_ios_prefix_lists.py b/tests/unit/modules/network/ios/test_ios_prefix_lists.py index 7812ce8d1..0df4be859 100644 --- a/tests/unit/modules/network/ios/test_ios_prefix_lists.py +++ b/tests/unit/modules/network/ios/test_ios_prefix_lists.py @@ -8,6 +8,7 @@ __metaclass__ = type from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_prefix_lists from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -24,9 +25,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.prefix_lists.prefix_lists." diff --git a/tests/unit/modules/network/ios/test_ios_route_maps.py b/tests/unit/modules/network/ios/test_ios_route_maps.py index aba125136..27c5aa7f6 100644 --- a/tests/unit/modules/network/ios/test_ios_route_maps.py +++ b/tests/unit/modules/network/ios/test_ios_route_maps.py @@ -8,6 +8,7 @@ __metaclass__ = type from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_route_maps from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -24,9 +25,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.route_maps.route_maps." @@ -60,7 +59,8 @@ def test_ios_route_maps_merged(self): as_path=dict(acls=[100, 120]), clns=dict(address="test_osi"), community=dict( - exact_match=True, name=["new_merge"] + exact_match=True, + name=["new_merge"], ), ip=dict(address=dict(acls=[10, 100])), length=dict(maximum=50000, minimum=5000), @@ -256,7 +256,8 @@ def test_ios_route_maps_replaced(self): as_path=dict(acls=[100, 120]), clns=dict(address="test_osi"), community=dict( - exact_match=True, name=["new_replace"] + exact_match=True, + name=["new_replace"], ), ip=dict(address=dict(acls=[10, 100])), length=dict(maximum=50000, minimum=5000), @@ -466,7 +467,8 @@ def test_ios_route_maps_overridden(self): as_path=dict(acls=[100, 120]), clns=dict(address="test_osi"), community=dict( - exact_match=True, name=["new_override"] + exact_match=True, + name=["new_override"], ), ip=dict(address=dict(acls=[10, 100])), length=dict(maximum=50000, minimum=5000), @@ -722,7 +724,7 @@ def test_ios_route_maps_rendered(self): set=dict( as_path=dict( prepend=dict( - as_number=["65512", 65522, "65532", 65543] + as_number=["65512", 65522, "65532", 65543], ), ), ), diff --git a/tests/unit/modules/network/ios/test_ios_service.py b/tests/unit/modules/network/ios/test_ios_service.py index 526056b84..fa92efcdc 100644 --- a/tests/unit/modules/network/ios/test_ios_service.py +++ b/tests/unit/modules/network/ios/test_ios_service.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_service from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.service.service." diff --git a/tests/unit/modules/network/ios/test_ios_snmp_server.py b/tests/unit/modules/network/ios/test_ios_snmp_server.py index ae42fa53e..0b8f797a1 100644 --- a/tests/unit/modules/network/ios/test_ios_snmp_server.py +++ b/tests/unit/modules/network/ios/test_ios_snmp_server.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_snmp_server from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -25,9 +25,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.snmp_server.snmp_server." @@ -1975,7 +1973,7 @@ def test_ios_snmp_server_rendered_user_options(self): }, ) rendered = [ - "snmp-server user paul familypaul v3 auth md5 somepass priv aes 128 somepass" + "snmp-server user paul familypaul v3 auth md5 somepass priv aes 128 somepass", ] result = self.execute_module(changed=False) self.maxDiff = None diff --git a/tests/unit/modules/network/ios/test_ios_static_routes.py b/tests/unit/modules/network/ios/test_ios_static_routes.py index 9c28648e6..57a416433 100644 --- a/tests/unit/modules/network/ios/test_ios_static_routes.py +++ b/tests/unit/modules/network/ios/test_ios_static_routes.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_static_routes from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.static_routes.static_routes." @@ -1736,7 +1734,7 @@ def test_ios_delete_static_route_vrf_based(self): dict( vrf="testVrf2", address_families=[ - dict(afi="ipv4", routes=[dict(dest="192.0.2.0/24")]) + dict(afi="ipv4", routes=[dict(dest="192.0.2.0/24")]), ], ), dict( @@ -2152,7 +2150,7 @@ def test_ios_static_route_gathered(self): { "dest": "10.0.0.0/8", "next_hops": [ - {"interface": "Null0", "permanent": True} + {"interface": "Null0", "permanent": True}, ], }, ], diff --git a/tests/unit/modules/network/ios/test_ios_system.py b/tests/unit/modules/network/ios/test_ios_system.py index 23908ccfa..915d7a1f7 100644 --- a/tests/unit/modules/network/ios/test_ios_system.py +++ b/tests/unit/modules/network/ios/test_ios_system.py @@ -22,6 +22,7 @@ __metaclass__ = type from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_system from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -73,7 +74,7 @@ def test_ios_system_domain_name_complex(self): domain_name=[ {"name": "test.com", "vrf": "test"}, {"name": "eng.example.net"}, - ] + ], ), ) commands = [ diff --git a/tests/unit/modules/network/ios/test_ios_user.py b/tests/unit/modules/network/ios/test_ios_user.py index b62041b57..a13467afb 100644 --- a/tests/unit/modules/network/ios/test_ios_user.py +++ b/tests/unit/modules/network/ios/test_ios_user.py @@ -21,6 +21,7 @@ __metaclass__ = type from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_user from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -117,7 +118,7 @@ def test_ios_user_view(self): def test_ios_user_update_password_changed(self): set_module_args( - dict(name="test", configured_password="test", update_password="on_create") + dict(name="test", configured_password="test", update_password="on_create"), ) result = self.execute_module(changed=True) self.assertEqual(result["commands"], ["username test secret test"]) @@ -125,14 +126,16 @@ def test_ios_user_update_password_changed(self): def test_ios_user_update_password_on_create_ok(self): set_module_args( dict( - name="ansible", configured_password="test", update_password="on_create" + name="ansible", + configured_password="test", + update_password="on_create", ), ) self.execute_module() def test_ios_user_update_password_always(self): set_module_args( - dict(name="ansible", configured_password="test", update_password="always") + dict(name="ansible", configured_password="test", update_password="always"), ) result = self.execute_module(changed=True) self.assertEqual(result["commands"], ["username ansible secret test"]) @@ -163,9 +166,7 @@ def test_ios_user_set_sshkey_multiple(self): self.assertEqual(result["commands"], commands) def test_add_hashed_password(self): - hashed_password_val = ( - "replacementforhashwhichissupposedtogohereonlyfortestingpurposes" - ) + hashed_password_val = "replacementforhashwhichissupposedtogohereonlyfortestingpurposes" set_module_args( dict( name="ansible", @@ -177,7 +178,8 @@ def test_add_hashed_password(self): ) result = self.execute_module(changed=True) self.assertEqual( - result["commands"], [f"username ansible secret 9 {hashed_password_val}"] + result["commands"], + [f"username ansible secret 9 {hashed_password_val}"], ) def test_add_hpassword_with_type(self): diff --git a/tests/unit/modules/network/ios/test_ios_vlans.py b/tests/unit/modules/network/ios/test_ios_vlans.py index fd054b2d0..a8a848020 100644 --- a/tests/unit/modules/network/ios/test_ios_vlans.py +++ b/tests/unit/modules/network/ios/test_ios_vlans.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_vlans from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vlans.vlans." diff --git a/tests/unit/modules/network/ios/test_ios_vrf.py b/tests/unit/modules/network/ios/test_ios_vrf.py index 555937d1c..f39061989 100644 --- a/tests/unit/modules/network/ios/test_ios_vrf.py +++ b/tests/unit/modules/network/ios/test_ios_vrf.py @@ -22,6 +22,7 @@ __metaclass__ = type from unittest.mock import patch + from ansible_collections.cisco.ios.plugins.modules import ios_vrf from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -186,7 +187,7 @@ def test_ios_vrf_route_both(self): def test_ios_vrf_route_import(self): set_module_args( - dict(name="test_6", rd="3:100", route_import=["3:100", "4:100"]) + dict(name="test_6", rd="3:100", route_import=["3:100", "4:100"]), ) commands = [ "vrf definition test_6", @@ -198,7 +199,7 @@ def test_ios_vrf_route_import(self): def test_ios_vrf_route_export(self): set_module_args( - dict(name="test_7", rd="4:100", route_export=["3:100", "4:100"]) + dict(name="test_7", rd="4:100", route_export=["3:100", "4:100"]), ) commands = [ "vrf definition test_7", @@ -297,7 +298,9 @@ def test_ios_vrf_route_both_ipv4_mixed(self): def test_ios_vrf_route_both_ipv6(self): set_module_args( dict( - name="test_13", rd="2:100", route_both_ipv6=["2:100", "168.0.0.13:100"] + name="test_13", + rd="2:100", + route_both_ipv6=["2:100", "168.0.0.13:100"], ), ) commands = [ diff --git a/tests/unit/modules/network/ios/test_ios_vxlan_vtep.py b/tests/unit/modules/network/ios/test_ios_vxlan_vtep.py index 7ef344fec..13e6a5380 100644 --- a/tests/unit/modules/network/ios/test_ios_vxlan_vtep.py +++ b/tests/unit/modules/network/ios/test_ios_vxlan_vtep.py @@ -7,8 +7,8 @@ __metaclass__ = type -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.ios.plugins.modules import ios_vxlan_vtep from ansible_collections.cisco.ios.tests.unit.modules.utils import set_module_args @@ -26,9 +26,7 @@ def setUp(self): "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base." "get_resource_connection", ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) + self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vxlan_vtep.vxlan_vtep."