@@ -101,7 +101,7 @@ def test_parse_network(self, mock_get_keyfiles_by_type):
101101 self .netpreserver .nmconnection_file + "/eth0.nmconnection"
102102 )
103103 nmconn_with_id = {
104- "connection" : { " id" : "eth0" } ,
104+ "id" : "eth0" ,
105105 "mac-address" : "00:11:22:33:44:55" ,
106106 "address1" : "192.168.1.10/24"
107107 }
@@ -116,21 +116,35 @@ def test_parse_network(self, mock_get_keyfiles_by_type):
116116 self .netpreserver .nmconnection_file + "/eth2.nmconnection"
117117 )
118118 nmconn_without_mac_address = {
119- "connection" : { " id" : "eth2" } ,
119+ "id" : "eth2" ,
120120 "address1" : "192.168.1.30/24" ,
121121 }
122122 nmconn_file_without_mac_address_ip_address = (
123123 self .netpreserver .nmconnection_file + "/eth3.nmconnection"
124124 )
125125 nmconn_without_mac_address_ip_address = {
126- "connection" : {"id" : "eth3" },
126+ "id" : "id_eth3" ,
127+ "address" : "192.168.1.40/24" ,
128+ }
129+ nmconn_file_with_space = (
130+ self .netpreserver .nmconnection_file + "/System ethx.nmconnection"
131+ )
132+ nmconn_without_mac_address_and_id = {
133+ "address1" : "192.168.1.50/24" ,
134+ }
135+ nmconn_with_interface_name = {
136+ "interface-name" : "eth4" ,
137+ "id" : "id_eth4" ,
138+ "address" : "192.168.1.60/24" ,
127139 }
128140 mock_get_keyfiles_by_type .return_value = [
129141 (nmconn_file_with_id , nmconn_with_id ),
130142 (nmconn_file_without_id , nmconn_without_id ),
131143 (nmconn_file_without_mac_address , nmconn_without_mac_address ),
132144 (nmconn_file_without_mac_address_ip_address ,
133- nmconn_without_mac_address_ip_address )
145+ nmconn_without_mac_address_ip_address ),
146+ (nmconn_file_with_space , nmconn_without_mac_address_and_id ),
147+ (nmconn_file_with_space , nmconn_with_interface_name )
134148 ]
135149
136150 self .netpreserver .interface_info = {}
@@ -150,10 +164,18 @@ def test_parse_network(self, mock_get_keyfiles_by_type):
150164 "mac_address" : None ,
151165 "ip_addresses" : ["192.168.1.30" ]
152166 },
153- "eth3" : {
167+ "id_eth3" : {
168+ "mac_address" : None ,
169+ "ip_addresses" : ["192.168.1.40" ]
170+ },
171+ "System_ethx" : {
172+ "mac_address" : None ,
173+ "ip_addresses" : ["192.168.1.50" ]
174+ },
175+ "eth4" : {
154176 "mac_address" : None ,
155- "ip_addresses" : []
177+ "ip_addresses" : ["192.168.1.60" ]
156178 }
157179 }
158180
159- self .assertEqual (self .netpreserver .interface_info , expected_info )
181+ self .assertEqual (expected_info , self .netpreserver .interface_info )
0 commit comments