Fix person device_trackers null (#31829)
This commit is contained in:
1 parent
f396f1cb18
commit
52b045ed30
3 files changed
+49
-10
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"""The tests for the person component."""
|
||||
import logging
|
||||
from unittest.mock import patch
|
||||
|
||||
from asynctest import patch
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import person
|
||||
@@ -773,3 +773,15 @@ async def test_reload(hass, hass_admin_user):
|
||||
assert state_2 is None
|
||||
assert state_3 is not None
|
||||
assert state_3.name == "Person 3"
|
||||
|
||||
|
||||
async def test_person_storage_fixing_device_trackers(storage_collection):
|
||||
"""Test None device trackers become lists."""
|
||||
with patch.object(
|
||||
storage_collection.store,
|
||||
"async_load",
|
||||
return_value={"items": [{"id": "bla", "name": "bla", "device_trackers": None}]},
|
||||
):
|
||||
await storage_collection.async_load()
|
||||
|
||||
assert storage_collection.data["bla"]["device_trackers"] == []
|
||||
Reference in new issue
Block a user