Fix zeroconf test inadvertently matching strings that start with name (#49578)

* Fix zeroconf test inadvertently matching strings that start with name

* adjust

* adjust
This commit is contained in:
J. Nick Koston 2021-04-27 23:47:36 -10:00 committed by GitHub
parent 14869483ca
commit 3f547e58d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ def service_update_mock(zeroconf, services, handlers, *, limit_service=None):
for service in services:
if limit_service is not None and service != limit_service:
continue
handlers[0](zeroconf, service, f"name.{service}", ServiceStateChange.Added)
handlers[0](zeroconf, service, f"_name.{service}", ServiceStateChange.Added)
def get_service_info_mock(service_type, name):
@ -273,7 +273,7 @@ async def test_service_with_invalid_name(hass, mock_zeroconf, caplog):
await hass.async_block_till_done()
assert len(mock_service_browser.mock_calls) == 1
assert "Failed to get info for device name" in caplog.text
assert "Failed to get info for device" in caplog.text
async def test_zeroconf_match_macaddress(hass, mock_zeroconf):