diff --git a/tests/components/emonitor/test_config_flow.py b/tests/components/emonitor/test_config_flow.py index 2a5a1a7a2d3..af4c1ac2a8a 100644 --- a/tests/components/emonitor/test_config_flow.py +++ b/tests/components/emonitor/test_config_flow.py @@ -12,6 +12,12 @@ from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry +DHCP_SERVICE_INFO = dhcp.DhcpServiceInfo( + hostname="emonitor", + ip="1.2.3.4", + macaddress="aabbccddeeff", +) + def _mock_emonitor(): return EmonitorStatus( @@ -103,11 +109,7 @@ async def test_dhcp_can_confirm(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, - data=dhcp.DhcpServiceInfo( - hostname="emonitor", - ip="1.2.3.4", - macaddress="aa:bb:cc:dd:ee:ff", - ), + data=DHCP_SERVICE_INFO, ) await hass.async_block_till_done() @@ -146,11 +148,7 @@ async def test_dhcp_fails_to_connect(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, - data=dhcp.DhcpServiceInfo( - hostname="emonitor", - ip="1.2.3.4", - macaddress="aa:bb:cc:dd:ee:ff", - ), + data=DHCP_SERVICE_INFO, ) await hass.async_block_till_done() @@ -175,11 +173,7 @@ async def test_dhcp_already_exists(hass: HomeAssistant) -> None: result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, - data=dhcp.DhcpServiceInfo( - hostname="emonitor", - ip="1.2.3.4", - macaddress="aa:bb:cc:dd:ee:ff", - ), + data=DHCP_SERVICE_INFO, ) await hass.async_block_till_done()