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
This commit is contained in:
parent
cd1c633ff9
commit
5988db1670
2 changed files with 5 additions and 4 deletions
|
@ -18,6 +18,7 @@ from tests.common import MockConfigEntry
|
||||||
HOST = "1.2.3.4"
|
HOST = "1.2.3.4"
|
||||||
PASSWORD = "123456"
|
PASSWORD = "123456"
|
||||||
MAC = format_mac("AA:BB:CC:DD:EE:FF")
|
MAC = format_mac("AA:BB:CC:DD:EE:FF")
|
||||||
|
DHCP_FORMATTED_MAC = MAC.replace(":", "")
|
||||||
USERNAME = "admin"
|
USERNAME = "admin"
|
||||||
|
|
||||||
CONF_DHCP_DATA = {
|
CONF_DHCP_DATA = {
|
||||||
|
@ -30,13 +31,13 @@ CONF_DATA = CONF_DHCP_DATA | {CONF_HOST: HOST}
|
||||||
|
|
||||||
CONF_DHCP_FLOW = dhcp.DhcpServiceInfo(
|
CONF_DHCP_FLOW = dhcp.DhcpServiceInfo(
|
||||||
ip=HOST,
|
ip=HOST,
|
||||||
macaddress=MAC,
|
macaddress=DHCP_FORMATTED_MAC,
|
||||||
hostname="dsp-w215",
|
hostname="dsp-w215",
|
||||||
)
|
)
|
||||||
|
|
||||||
CONF_DHCP_FLOW_NEW_IP = dhcp.DhcpServiceInfo(
|
CONF_DHCP_FLOW_NEW_IP = dhcp.DhcpServiceInfo(
|
||||||
ip="5.6.7.8",
|
ip="5.6.7.8",
|
||||||
macaddress=MAC,
|
macaddress=DHCP_FORMATTED_MAC,
|
||||||
hostname="dsp-w215",
|
hostname="dsp-w215",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ def config_entry(hass: HomeAssistant) -> MockConfigEntry:
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def config_entry_with_uid(hass: HomeAssistant) -> MockConfigEntry:
|
def config_entry_with_uid(hass: HomeAssistant) -> MockConfigEntry:
|
||||||
"""Add config entry with unique ID in Home Assistant."""
|
"""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
|
@pytest.fixture
|
||||||
|
|
|
@ -152,7 +152,7 @@ async def test_dhcp_already_configured(
|
||||||
|
|
||||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||||
assert result["reason"] == "already_configured"
|
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(
|
async def test_dhcp_unique_id_assignment(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue