Fix formatting of mac addresses from dhcp discovery mocking in lifx (#110581)

dhcp returns addresses in lowercase without :
This commit is contained in:
J. Nick Koston 2024-02-14 13:53:26 -06:00 committed by GitHub
parent 815232069a
commit 98263d7d76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 7 deletions

View File

@ -17,6 +17,7 @@ LABEL = "My Bulb"
GROUP = "My Group"
SERIAL = "aa:bb:cc:dd:ee:cc"
MAC_ADDRESS = "aa:bb:cc:dd:ee:cd"
DHCP_FORMATTED_MAC = "aabbccddeecd"
DEFAULT_ENTRY_TITLE = LABEL

View File

@ -17,9 +17,9 @@ from homeassistant.setup import async_setup_component
from . import (
DEFAULT_ENTRY_TITLE,
DHCP_FORMATTED_MAC,
IP_ADDRESS,
LABEL,
MAC_ADDRESS,
MODULE,
SERIAL,
_mocked_bulb,
@ -345,7 +345,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None:
DOMAIN,
context={"source": config_entries.SOURCE_DHCP},
data=dhcp.DhcpServiceInfo(
ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=LABEL
ip=IP_ADDRESS, macaddress=DHCP_FORMATTED_MAC, hostname=LABEL
),
)
await hass.async_block_till_done()
@ -357,7 +357,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None:
DOMAIN,
context={"source": config_entries.SOURCE_DHCP},
data=dhcp.DhcpServiceInfo(
ip=IP_ADDRESS, macaddress="00:00:00:00:00:00", hostname="mock_hostname"
ip=IP_ADDRESS, macaddress="000000000000", hostname="mock_hostname"
),
)
await hass.async_block_till_done()
@ -371,7 +371,7 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None:
DOMAIN,
context={"source": config_entries.SOURCE_DHCP},
data=dhcp.DhcpServiceInfo(
ip="1.2.3.5", macaddress="00:00:00:00:00:01", hostname="mock_hostname"
ip="1.2.3.5", macaddress="000000000001", hostname="mock_hostname"
),
)
await hass.async_block_till_done()
@ -384,7 +384,9 @@ async def test_discovered_by_discovery_and_dhcp(hass: HomeAssistant) -> None:
[
(
config_entries.SOURCE_DHCP,
dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=LABEL),
dhcp.DhcpServiceInfo(
ip=IP_ADDRESS, macaddress=DHCP_FORMATTED_MAC, hostname=LABEL
),
),
(
config_entries.SOURCE_HOMEKIT,
@ -439,7 +441,9 @@ async def test_discovered_by_dhcp_or_discovery(
[
(
config_entries.SOURCE_DHCP,
dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=LABEL),
dhcp.DhcpServiceInfo(
ip=IP_ADDRESS, macaddress=DHCP_FORMATTED_MAC, hostname=LABEL
),
),
(
config_entries.SOURCE_HOMEKIT,
@ -480,7 +484,9 @@ async def test_discovered_by_dhcp_or_discovery_failed_to_get_device(
[
(
config_entries.SOURCE_DHCP,
dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=LABEL),
dhcp.DhcpServiceInfo(
ip=IP_ADDRESS, macaddress=DHCP_FORMATTED_MAC, hostname=LABEL
),
),
(
config_entries.SOURCE_HOMEKIT,