Do not use AsyncTrackStates (#47255)

This commit is contained in:
Paulus Schoutsen
2021-03-11 23:18:09 -08:00
committed by GitHub
parent 2a22c54fcb
commit ff94e920e4
6 changed files with 73 additions and 43 deletions

View File

@@ -6,34 +6,13 @@ import pytest
from homeassistant.helpers import frame
async def test_extract_frame_integration(caplog):
async def test_extract_frame_integration(caplog, mock_integration_frame):
"""Test extracting the current frame from integration context."""
correct_frame = Mock(
filename="/home/paulus/homeassistant/components/hue/light.py",
lineno="23",
line="self.light.is_on",
)
with patch(
"homeassistant.helpers.frame.extract_stack",
return_value=[
Mock(
filename="/home/paulus/homeassistant/core.py",
lineno="23",
line="do_something()",
),
correct_frame,
Mock(
filename="/home/paulus/aiohue/lights.py",
lineno="2",
line="something()",
),
],
):
found_frame, integration, path = frame.get_integration_frame()
found_frame, integration, path = frame.get_integration_frame()
assert integration == "hue"
assert path == "homeassistant/components/"
assert found_frame == correct_frame
assert found_frame == mock_integration_frame
async def test_extract_frame_integration_with_excluded_intergration(caplog):