mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix history api with no constraints (#36979)
This commit is contained in:
parent
7e696f19d3
commit
e19c97af7c
@ -423,7 +423,7 @@ class HistoryPeriodView(HomeAssistantView):
|
||||
self, request: web.Request, datetime: Optional[str] = None
|
||||
) -> web.Response:
|
||||
"""Return history over a period of time."""
|
||||
|
||||
datetime_ = None
|
||||
if datetime:
|
||||
datetime_ = dt_util.parse_datetime(datetime)
|
||||
|
||||
|
@ -768,6 +768,16 @@ async def test_fetch_period_api_with_minimal_response(hass, hass_client):
|
||||
assert response.status == 200
|
||||
|
||||
|
||||
async def test_fetch_period_api_with_no_timestamp(hass, hass_client):
|
||||
"""Test the fetch period view for history with no timestamp."""
|
||||
await hass.async_add_executor_job(init_recorder_component, hass)
|
||||
await async_setup_component(hass, "history", {})
|
||||
await hass.async_add_job(hass.data[recorder.DATA_INSTANCE].block_till_done)
|
||||
client = await hass_client()
|
||||
response = await client.get("/api/history/period")
|
||||
assert response.status == 200
|
||||
|
||||
|
||||
async def test_fetch_period_api_with_include_order(hass, hass_client):
|
||||
"""Test the fetch period view for history."""
|
||||
await hass.async_add_executor_job(init_recorder_component, hass)
|
||||
|
Loading…
x
Reference in New Issue
Block a user