-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Tile device tracker tests (#134137)
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# serializer version: 1 | ||
# name: test_all_entities[device_tracker.wallet-entry] | ||
EntityRegistryEntrySnapshot({ | ||
'aliases': set({ | ||
}), | ||
'area_id': None, | ||
'capabilities': None, | ||
'config_entry_id': <ANY>, | ||
'device_class': None, | ||
'device_id': <ANY>, | ||
'disabled_by': None, | ||
'domain': 'device_tracker', | ||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, | ||
'entity_id': 'device_tracker.wallet', | ||
'has_entity_name': True, | ||
'hidden_by': None, | ||
'icon': None, | ||
'id': <ANY>, | ||
'labels': set({ | ||
}), | ||
'name': None, | ||
'options': dict({ | ||
}), | ||
'original_device_class': None, | ||
'original_icon': None, | ||
'original_name': None, | ||
'platform': 'tile', | ||
'previous_unique_id': None, | ||
'supported_features': 0, | ||
'translation_key': 'tile', | ||
'unique_id': 'user@host.com_19264d2dffdbca32', | ||
'unit_of_measurement': None, | ||
}) | ||
# --- | ||
# name: test_all_entities[device_tracker.wallet-state] | ||
StateSnapshot({ | ||
'attributes': ReadOnlyDict({ | ||
'altitude': 0, | ||
'friendly_name': 'Wallet', | ||
'gps_accuracy': 1, | ||
'is_lost': False, | ||
'last_lost_timestamp': datetime.datetime(1970, 1, 1, 3, 0, tzinfo=datetime.timezone.utc), | ||
'last_timestamp': datetime.datetime(2020, 8, 13, 0, 55, 26, tzinfo=datetime.timezone.utc), | ||
'latitude': 1, | ||
'longitude': 1, | ||
'ring_state': 'STOPPED', | ||
'source_type': <SourceType.GPS: 'gps'>, | ||
'voip_state': 'OFFLINE', | ||
}), | ||
'context': <ANY>, | ||
'entity_id': 'device_tracker.wallet', | ||
'last_changed': <ANY>, | ||
'last_reported': <ANY>, | ||
'last_updated': <ANY>, | ||
'state': 'not_home', | ||
}) | ||
# --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Tests for the Tile Device tracker platform.""" | ||
|
||
from unittest.mock import AsyncMock, patch | ||
|
||
from syrupy import SnapshotAssertion | ||
|
||
from homeassistant.const import Platform | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers import entity_registry as er | ||
|
||
from . import setup_integration | ||
|
||
from tests.common import MockConfigEntry, snapshot_platform | ||
|
||
|
||
async def test_all_entities( | ||
hass: HomeAssistant, | ||
snapshot: SnapshotAssertion, | ||
mock_pytile: AsyncMock, | ||
mock_config_entry: MockConfigEntry, | ||
entity_registry: er.EntityRegistry, | ||
) -> None: | ||
"""Test all entities.""" | ||
with patch("homeassistant.components.tile.PLATFORMS", [Platform.DEVICE_TRACKER]): | ||
await setup_integration(hass, mock_config_entry) | ||
|
||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) |