Fix formatting of mac addresses from dhcp discovery mocking in dlink (#110562)

* Fix formatting of mac addresses from dhcp discovery mocking in dlink

dhcp returns addresses in lowercase without :

* fix tests
pull/110622/head
J. Nick Koston 2024-02-14 16:07:45 -06:00 committed by GitHub
parent cd1c633ff9
commit 5988db1670
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -18,6 +18,7 @@ from tests.common import MockConfigEntry
HOST = "1.2.3.4"
PASSWORD = "123456"
MAC = format_mac("AA:BB:CC:DD:EE:FF")
DHCP_FORMATTED_MAC = MAC.replace(":", "")
USERNAME = "admin"
CONF_DHCP_DATA = {
@ -30,13 +31,13 @@ CONF_DATA = CONF_DHCP_DATA | {CONF_HOST: HOST}
CONF_DHCP_FLOW = dhcp.DhcpServiceInfo(
ip=HOST,
macaddress=MAC,
macaddress=DHCP_FORMATTED_MAC,
hostname="dsp-w215",
)
CONF_DHCP_FLOW_NEW_IP = dhcp.DhcpServiceInfo(
ip="5.6.7.8",
macaddress=MAC,
macaddress=DHCP_FORMATTED_MAC,
hostname="dsp-w215",
)
@ -59,7 +60,7 @@ def config_entry(hass: HomeAssistant) -> MockConfigEntry:
@pytest.fixture
def config_entry_with_uid(hass: HomeAssistant) -> MockConfigEntry:
"""Add config entry with unique ID in Home Assistant."""
return create_entry(hass, unique_id="aa:bb:cc:dd:ee:ff")
return create_entry(hass, unique_id="aabbccddeeff")
@pytest.fixture

View File

@ -152,7 +152,7 @@ async def test_dhcp_already_configured(
assert result["type"] == data_entry_flow.FlowResultType.ABORT
assert result["reason"] == "already_configured"
assert config_entry.unique_id == "aa:bb:cc:dd:ee:ff"
assert config_entry.unique_id == "aabbccddeeff"
async def test_dhcp_unique_id_assignment(