mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add compatibility tests for UsbServiceInfo (#60753)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
7f355681a7
commit
2fe0382841
@ -777,3 +777,27 @@ def test_human_readable_device_name():
|
||||
assert "Silicon Labs" in name
|
||||
assert "10C4" in name
|
||||
assert "8A2A" in name
|
||||
|
||||
|
||||
async def test_service_info_compatibility(hass, caplog):
|
||||
"""Test compatibility with old-style dict.
|
||||
|
||||
To be removed in 2022.6
|
||||
"""
|
||||
discovery_info = usb.UsbServiceInfo(
|
||||
device=slae_sh_device.device,
|
||||
vid=12345,
|
||||
pid=12345,
|
||||
serial_number=slae_sh_device.serial_number,
|
||||
manufacturer=slae_sh_device.manufacturer,
|
||||
description=slae_sh_device.description,
|
||||
)
|
||||
|
||||
# Ensure first call get logged
|
||||
assert discovery_info["vid"] == 12345
|
||||
assert "Detected code that accessed discovery_info['vid']" in caplog.text
|
||||
|
||||
# Ensure second call doesn't get logged
|
||||
caplog.clear()
|
||||
assert discovery_info["vid"] == 12345
|
||||
assert "Detected code that accessed discovery_info['vid']" not in caplog.text
|
||||
|
Loading…
x
Reference in New Issue
Block a user