@@ -157,6 +157,7 @@ async def _async_get_handle_dhcp_packet(
157157 hass ,
158158 DHCPData (integration_matchers , set (), address_data ),
159159 )
160+
160161 with patch ("aiodhcpwatcher.async_start" ):
161162 await dhcp_watcher .async_start ()
162163
@@ -171,6 +172,53 @@ async def _async_handle_dhcp_packet(packet):
171172 return cast ("Callable[[Any], Awaitable[None]]" , _async_handle_dhcp_packet )
172173
173174
175+ async def test_dhcp_start_using_multiple_interfaces (
176+ hass : HomeAssistant ,
177+ ) -> None :
178+ """Test start using multiple interfaces."""
179+
180+ def _generate_mock_adapters ():
181+ return [
182+ {
183+ "index" : 1 ,
184+ "auto" : False ,
185+ "default" : False ,
186+ "enabled" : True ,
187+ "ipv4" : [{"address" : "192.168.0.1" , "network_prefix" : 24 }],
188+ "ipv6" : [],
189+ "name" : "eth0" ,
190+ },
191+ {
192+ "index" : 2 ,
193+ "auto" : True ,
194+ "default" : True ,
195+ "enabled" : True ,
196+ "ipv4" : [{"address" : "192.168.1.1" , "network_prefix" : 24 }],
197+ "ipv6" : [],
198+ "name" : "eth1" ,
199+ },
200+ ]
201+
202+ integration_matchers = dhcp .async_index_integration_matchers (
203+ [{"domain" : "mock-domain" , "hostname" : "connect" , "macaddress" : "B8B7F1*" }]
204+ )
205+ dhcp_watcher = dhcp .DHCPWatcher (
206+ hass ,
207+ DHCPData (integration_matchers , set (), {}),
208+ )
209+
210+ with (
211+ patch ("aiodhcpwatcher.async_start" ) as mock_start ,
212+ patch (
213+ "homeassistant.components.dhcp.network.async_get_adapters" ,
214+ return_value = _generate_mock_adapters (),
215+ ),
216+ ):
217+ await dhcp_watcher .async_start ()
218+
219+ mock_start .assert_called_with (dhcp_watcher ._async_process_dhcp_request , [1 , 2 ])
220+
221+
174222async def test_dhcp_match_hostname_and_macaddress (hass : HomeAssistant ) -> None :
175223 """Test matching based on hostname and macaddress."""
176224 integration_matchers = dhcp .async_index_integration_matchers (
0 commit comments