Skip to content

Commit

Permalink
Fix history api with no constraints (#36979)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Jun 22, 2020
1 parent 7e696f1 commit e19c97a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion homeassistant/components/history/__init__.py
Expand Up @@ -423,7 +423,7 @@ async def get(
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)

Expand Down
10 changes: 10 additions & 0 deletions tests/components/history/test_init.py
Expand Up @@ -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)
Expand Down

0 comments on commit e19c97a

Please sign in to comment.