mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fix formatting of mac addresses from dhcp discovery mocking in axis (#110560)
dhcp returns addresses in lowercase without :
This commit is contained in:
parent
d48a45fee7
commit
8da07f1bf2
@ -32,11 +32,14 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.data_entry_flow import FlowResultType
|
from homeassistant.data_entry_flow import FlowResultType
|
||||||
|
from homeassistant.helpers import device_registry as dr
|
||||||
|
|
||||||
from .const import DEFAULT_HOST, MAC, MODEL, NAME
|
from .const import DEFAULT_HOST, MAC, MODEL, NAME
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
|
DHCP_FORMATTED_MAC = dr.format_mac(MAC).replace(":", "")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="mock_config_entry")
|
@pytest.fixture(name="mock_config_entry")
|
||||||
async def mock_config_entry_fixture(hass, config_entry, mock_setup_entry):
|
async def mock_config_entry_fixture(hass, config_entry, mock_setup_entry):
|
||||||
@ -253,7 +256,7 @@ async def test_reauth_flow_update_configuration(
|
|||||||
dhcp.DhcpServiceInfo(
|
dhcp.DhcpServiceInfo(
|
||||||
hostname=f"axis-{MAC}",
|
hostname=f"axis-{MAC}",
|
||||||
ip=DEFAULT_HOST,
|
ip=DEFAULT_HOST,
|
||||||
macaddress=MAC,
|
macaddress=DHCP_FORMATTED_MAC,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -360,7 +363,7 @@ async def test_discovery_flow(
|
|||||||
dhcp.DhcpServiceInfo(
|
dhcp.DhcpServiceInfo(
|
||||||
hostname=f"axis-{MAC}",
|
hostname=f"axis-{MAC}",
|
||||||
ip=DEFAULT_HOST,
|
ip=DEFAULT_HOST,
|
||||||
macaddress=MAC,
|
macaddress=DHCP_FORMATTED_MAC,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -412,7 +415,7 @@ async def test_discovered_device_already_configured(
|
|||||||
dhcp.DhcpServiceInfo(
|
dhcp.DhcpServiceInfo(
|
||||||
hostname=f"axis-{MAC}",
|
hostname=f"axis-{MAC}",
|
||||||
ip="2.3.4.5",
|
ip="2.3.4.5",
|
||||||
macaddress=MAC,
|
macaddress=DHCP_FORMATTED_MAC,
|
||||||
),
|
),
|
||||||
80,
|
80,
|
||||||
),
|
),
|
||||||
@ -488,7 +491,7 @@ async def test_discovery_flow_updated_configuration(
|
|||||||
dhcp.DhcpServiceInfo(
|
dhcp.DhcpServiceInfo(
|
||||||
hostname="",
|
hostname="",
|
||||||
ip="",
|
ip="",
|
||||||
macaddress="01234567890",
|
macaddress=dr.format_mac("01234567890").replace(":", ""),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -537,7 +540,7 @@ async def test_discovery_flow_ignore_non_axis_device(
|
|||||||
dhcp.DhcpServiceInfo(
|
dhcp.DhcpServiceInfo(
|
||||||
hostname=f"axis-{MAC}",
|
hostname=f"axis-{MAC}",
|
||||||
ip="169.254.3.4",
|
ip="169.254.3.4",
|
||||||
macaddress=MAC,
|
macaddress=DHCP_FORMATTED_MAC,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user