forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_recorder.py
42 lines (33 loc) · 1.35 KB
/
test_recorder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""The tests for the recorder helpers."""
from unittest.mock import patch
from homeassistant.core import HomeAssistant
from homeassistant.helpers import recorder
from tests.typing import RecorderInstanceGenerator
async def test_async_migration_in_progress(
async_setup_recorder_instance: RecorderInstanceGenerator, hass: HomeAssistant
) -> None:
"""Test async_migration_in_progress wraps the recorder."""
with patch(
"homeassistant.components.recorder.util.async_migration_in_progress",
return_value=False,
):
assert recorder.async_migration_in_progress(hass) is False
with patch(
"homeassistant.components.recorder.util.async_migration_in_progress",
return_value=True,
):
assert recorder.async_migration_in_progress(hass) is True
async def test_async_migration_is_live(
async_setup_recorder_instance: RecorderInstanceGenerator, hass: HomeAssistant
) -> None:
"""Test async_migration_in_progress wraps the recorder."""
with patch(
"homeassistant.components.recorder.util.async_migration_is_live",
return_value=False,
):
assert recorder.async_migration_is_live(hass) is False
with patch(
"homeassistant.components.recorder.util.async_migration_is_live",
return_value=True,
):
assert recorder.async_migration_is_live(hass) is True