Fix history API (#13214)
This commit is contained in:
parent
ef7ce5eb1b
commit
a9917e7a56
2 changed files with 16 additions and 6 deletions
|
@ -4,7 +4,7 @@ from datetime import timedelta
|
|||
import unittest
|
||||
from unittest.mock import patch, sentinel
|
||||
|
||||
from homeassistant.setup import setup_component
|
||||
from homeassistant.setup import setup_component, async_setup_component
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.components import history, recorder
|
||||
|
@ -481,3 +481,13 @@ class TestComponentHistory(unittest.TestCase):
|
|||
set_state(therm, 22, attributes={'current_temperature': 21,
|
||||
'hidden': True})
|
||||
return zero, four, states
|
||||
|
||||
|
||||
async def test_fetch_period_api(hass, test_client):
|
||||
"""Test the fetch period view for history."""
|
||||
await hass.async_add_job(init_recorder_component, hass)
|
||||
await async_setup_component(hass, 'history', {})
|
||||
client = await test_client(hass.http.app)
|
||||
response = await client.get(
|
||||
'/api/history/period/{}'.format(dt_util.utcnow().isoformat()))
|
||||
assert response.status == 200
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue