-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
24 additions
and
2 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
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,22 @@ | ||
"""Test Subaru device tracker.""" | ||
from subarulink.const import LATITUDE, LONGITUDE | ||
|
||
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers import entity_registry as er | ||
|
||
from .api_responses import EXPECTED_STATE_EV_IMPERIAL | ||
|
||
DEVICE_ID = "device_tracker.test_vehicle_2" | ||
|
||
|
||
async def test_location(hass: HomeAssistant, ev_entry) -> None: | ||
"""Test subaru location entity exists and has correct info.""" | ||
entity_registry = er.async_get(hass) | ||
entry = entity_registry.async_get(DEVICE_ID) | ||
assert entry | ||
actual = hass.states.get(DEVICE_ID) | ||
assert ( | ||
actual.attributes.get(ATTR_LONGITUDE) == EXPECTED_STATE_EV_IMPERIAL[LONGITUDE] | ||
) | ||
assert actual.attributes.get(ATTR_LATITUDE) == EXPECTED_STATE_EV_IMPERIAL[LATITUDE] |