From ab60a47475fe792f0e52fc017883cc34e8fda42a Mon Sep 17 00:00:00 2001 From: Till Maas Date: Thu, 6 Jun 2019 22:05:25 +0200 Subject: [PATCH] connections unit tests: Introduce ETHERNET_DEFAULTS --- tests/unit/test_network_connections.py | 42 ++++++++++++++------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/unit/test_network_connections.py b/tests/unit/test_network_connections.py index 7bb1b4b..d9918f6 100755 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -67,6 +67,8 @@ def pprint(msg, obj): ARGS_CONNECTIONS = network_lsr.argument_validator.ArgValidator_ListConnections() VALIDATE_ONE_MODE_INITSCRIPTS = ARGS_CONNECTIONS.VALIDATE_ONE_MODE_INITSCRIPTS +ETHERNET_DEFAULTS = {"autoneg": None, "duplex": None, "speed": 0} + class TestValidator(unittest.TestCase): def setUp(self): @@ -74,7 +76,7 @@ class TestValidator(unittest.TestCase): self.default_connection_settings = { "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "ignore_errors": None, "ip": { "gateway6": None, @@ -313,7 +315,7 @@ class TestValidator(unittest.TestCase): "actions": ["present"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "ignore_errors": None, "interface_name": "5", "ip": { @@ -361,7 +363,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "5", @@ -404,7 +406,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": False, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "5", @@ -484,7 +486,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": None, @@ -544,7 +546,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "prod1", @@ -601,7 +603,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": None, @@ -647,7 +649,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "prod.100", @@ -736,7 +738,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": None, @@ -782,7 +784,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "prod.100", @@ -871,7 +873,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "eth0", @@ -1059,7 +1061,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "bridge2", @@ -1094,7 +1096,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "eth1", @@ -1153,7 +1155,7 @@ class TestValidator(unittest.TestCase): "autoconnect": True, "bond": {"mode": "balance-rr", "miimon": None}, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "bond1", @@ -1197,7 +1199,7 @@ class TestValidator(unittest.TestCase): "autoconnect": True, "bond": {"mode": "active-backup", "miimon": None}, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "bond1", @@ -1252,7 +1254,7 @@ class TestValidator(unittest.TestCase): "actions": ["present"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "ignore_errors": None, "interface_name": None, "ip": { @@ -1363,7 +1365,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "6643-master", @@ -1398,7 +1400,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "6643", @@ -1592,7 +1594,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "555", @@ -1682,7 +1684,7 @@ class TestValidator(unittest.TestCase): "actions": ["present", "up"], "autoconnect": True, "check_iface_exists": True, - "ethernet": {"autoneg": None, "duplex": None, "speed": 0}, + "ethernet": ETHERNET_DEFAULTS, "force_state_change": None, "ignore_errors": None, "interface_name": "e556",