Skip to content

Commit

Permalink
Fix formatting of mac addresses from dhcp discovery mocking in lifx (#…
Browse files Browse the repository at this point in the history
…110581)

dhcp returns addresses in lowercase without :
  • Loading branch information
bdraco authored Feb 14, 2024
1 parent 8152320 commit 98263d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions tests/components/lifx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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


Expand Down
20 changes: 13 additions & 7 deletions tests/components/lifx/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

from . import (
DEFAULT_ENTRY_TITLE,
DHCP_FORMATTED_MAC,
IP_ADDRESS,
LABEL,
MAC_ADDRESS,
MODULE,
SERIAL,
_mocked_bulb,
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 98263d7

Please sign in to comment.