diff --git a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py index 3e165a038eef..688068b370f1 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py +++ b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py @@ -116,11 +116,13 @@ def test_get_ports_from_connections(self, get_iface_from_connection): assert get_ports_from_connections(nm_client, "team", [TEAM1_UUID]) == \ set([("ens11", "ens11", ENS11_UUID)]) + @patch("pyanaconda.modules.network.nm_client._get_dracut_znet_argument_from_connection") @patch("pyanaconda.modules.network.nm_client.get_connections_available_for_iface") @patch("pyanaconda.modules.network.nm_client.get_ports_from_connections") @patch("pyanaconda.modules.network.nm_client.is_s390") def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_connections_mock, - get_connections_available_for_iface): + get_connections_available_for_iface, + _get_dracut_znet_argument_from_connection): nm_client = Mock() CON_UUID = "44755f4c-ee12-45b4-ba5e-e10f83de51af" @@ -162,6 +164,8 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn # IPv4 config static, mac address not specified, s390 is_s390.return_value = True + _get_dracut_znet_argument_from_connection.return_value = \ + "rd.znet=qeth,0.0.0900,0.0.0901,0.0.0902,layer2=1,portname=FOOBAR,portno=0" address_attrs = { "get_address.return_value": "10.34.39.44", "get_prefix.return_value": 24, @@ -176,11 +180,6 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn ip4_config = self._get_mock_objects_from_attrs([ip4_config_attrs])[0] wired_setting_attrs = { "get_mac_address.return_value": None, - "get_s390_nettype.return_value": "qeth", - "get_s390_subchannels.return_value": ["0.0.0900", "0.0.0901", "0.0.0902"], - "get_property.return_value": {"layer2": "1", - "portname": "FOOBAR", - "portno": "0"}, } wired_setting = self._get_mock_objects_from_attrs([wired_setting_attrs])[0] cons_attrs = [ @@ -189,6 +188,7 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn "get_setting_ip4_config.return_value": ip4_config, "get_setting_wired.return_value": wired_setting, "get_connection_type.return_value": NM_CONNECTION_TYPE_ETHERNET, + "get_interface_name": "ens4", }, ] con = self._get_mock_objects_from_attrs(cons_attrs)[0] @@ -279,6 +279,8 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn # IPv4 config auto, vlan, s390, parent specified by interface name is_s390.return_value = True + _get_dracut_znet_argument_from_connection.return_value = \ + "rd.znet=qeth,0.0.0900,0.0.0901,0.0.0902,layer2=1,portname=FOOBAR,portno=0" ip4_config_attrs = { "get_method.return_value": NM.SETTING_IP4_CONFIG_METHOD_AUTO, } @@ -300,11 +302,6 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn # Mock parent connection wired_setting_attrs = { "get_mac_address.return_value": None, - "get_s390_nettype.return_value": "qeth", - "get_s390_subchannels.return_value": ["0.0.0900", "0.0.0901", "0.0.0902"], - "get_property.return_value": {"layer2": "1", - "portname": "FOOBAR", - "portno": "0"}, } wired_setting = self._get_mock_objects_from_attrs([wired_setting_attrs])[0] parent_cons_attrs = [ @@ -312,6 +309,7 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn "get_uuid.return_value": CON_UUID, "get_setting_wired.return_value": wired_setting, "get_connection_type.return_value": NM_CONNECTION_TYPE_ETHERNET, + "get_interface_name": "ens11", }, ] parent_cons = self._get_mock_objects_from_attrs(parent_cons_attrs) @@ -361,6 +359,8 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn # IPv4 config auto, vlan, parent specified by connection uuid, s390 (we # need the parent connection in s390 case, not only parent iface) is_s390.return_value = True + _get_dracut_znet_argument_from_connection.return_value = \ + "rd.znet=qeth,0.0.0900,0.0.0901,0.0.0902,layer2=1,portname=FOOBAR,portno=0" ip4_config_attrs = { "get_method.return_value": NM.SETTING_IP4_CONFIG_METHOD_AUTO, } @@ -382,11 +382,6 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn # Mock parent connection wired_setting_attrs = { "get_mac_address.return_value": None, - "get_s390_nettype.return_value": "qeth", - "get_s390_subchannels.return_value": ["0.0.0900", "0.0.0901", "0.0.0902"], - "get_property.return_value": {"layer2": "1", - "portname": "FOOBAR", - "portno": "0"}, } wired_setting = self._get_mock_objects_from_attrs([wired_setting_attrs])[0] parent_cons_attrs = [ @@ -396,6 +391,7 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn "get_id.return_value": "ens13", "get_setting_wired.return_value": wired_setting, "get_connection_type.return_value": NM_CONNECTION_TYPE_ETHERNET, + "get_interface_name": "ens13", }, ] parent_cons = self._get_mock_objects_from_attrs(parent_cons_attrs)