mirror of
https://github.com/home-assistant/core.git
synced 2025-12-23 20:39:01 +00:00
Remove deprecated hide_if_away from device trackers (#32705)
This commit is contained in:
@@ -15,7 +15,6 @@ from homeassistant.const import (
|
||||
ATTR_ENTITY_PICTURE,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
ATTR_GPS_ACCURACY,
|
||||
ATTR_HIDDEN,
|
||||
ATTR_ICON,
|
||||
ATTR_LATITUDE,
|
||||
ATTR_LONGITUDE,
|
||||
@@ -107,7 +106,6 @@ async def test_reading_yaml_config(hass, yaml_devices):
|
||||
"AB:CD:EF:GH:IJ",
|
||||
"Test name",
|
||||
picture="http://test.picture",
|
||||
hide_if_away=True,
|
||||
icon="mdi:kettle",
|
||||
)
|
||||
await hass.async_add_executor_job(
|
||||
@@ -121,7 +119,6 @@ async def test_reading_yaml_config(hass, yaml_devices):
|
||||
assert device.track == config.track
|
||||
assert device.mac == config.mac
|
||||
assert device.config_picture == config.config_picture
|
||||
assert device.away_hide == config.away_hide
|
||||
assert device.consider_home == config.consider_home
|
||||
assert device.icon == config.icon
|
||||
|
||||
@@ -284,7 +281,6 @@ async def test_entity_attributes(hass, mock_device_tracker_conf):
|
||||
None,
|
||||
friendly_name,
|
||||
picture,
|
||||
hide_if_away=True,
|
||||
icon=icon,
|
||||
)
|
||||
devices.append(device)
|
||||
@@ -299,25 +295,6 @@ async def test_entity_attributes(hass, mock_device_tracker_conf):
|
||||
assert picture == attrs.get(ATTR_ENTITY_PICTURE)
|
||||
|
||||
|
||||
async def test_device_hidden(hass, mock_device_tracker_conf):
|
||||
"""Test hidden devices."""
|
||||
devices = mock_device_tracker_conf
|
||||
dev_id = "test_entity"
|
||||
entity_id = f"{const.DOMAIN}.{dev_id}"
|
||||
device = legacy.Device(
|
||||
hass, timedelta(seconds=180), True, dev_id, None, hide_if_away=True
|
||||
)
|
||||
devices.append(device)
|
||||
|
||||
scanner = getattr(hass.components, "test.device_tracker").SCANNER
|
||||
scanner.reset()
|
||||
|
||||
with assert_setup_component(1, device_tracker.DOMAIN):
|
||||
assert await async_setup_component(hass, device_tracker.DOMAIN, TEST_PLATFORM)
|
||||
|
||||
assert hass.states.get(entity_id).attributes.get(ATTR_HIDDEN)
|
||||
|
||||
|
||||
@patch("homeassistant.components.device_tracker.legacy." "DeviceTracker.async_see")
|
||||
async def test_see_service(mock_see, hass):
|
||||
"""Test the see service with a unicode dev_id and NO MAC."""
|
||||
@@ -609,17 +586,6 @@ async def test_picture_and_icon_on_see_discovery(mock_device_tracker_conf, hass)
|
||||
assert mock_device_tracker_conf[0].entity_picture == "pic_url"
|
||||
|
||||
|
||||
async def test_default_hide_if_away_is_used(mock_device_tracker_conf, hass):
|
||||
"""Test that default track_new is used."""
|
||||
tracker = legacy.DeviceTracker(
|
||||
hass, timedelta(seconds=60), False, {device_tracker.CONF_AWAY_HIDE: True}, []
|
||||
)
|
||||
await tracker.async_see(dev_id=12)
|
||||
await hass.async_block_till_done()
|
||||
assert len(mock_device_tracker_conf) == 1
|
||||
assert mock_device_tracker_conf[0].away_hide
|
||||
|
||||
|
||||
async def test_backward_compatibility_for_track_new(mock_device_tracker_conf, hass):
|
||||
"""Test backward compatibility for track new."""
|
||||
tracker = legacy.DeviceTracker(
|
||||
|
||||
Reference in New Issue
Block a user