Files
core/tests/components/http/test_view.py
2018-11-28 13:25:23 +01:00

16 lines
419 B
Python

"""Tests for Home Assistant View."""
from aiohttp.web_exceptions import HTTPInternalServerError
import pytest
from homeassistant.components.http.view import HomeAssistantView
async def test_invalid_json(caplog):
"""Test trying to return invalid JSON."""
view = HomeAssistantView()
with pytest.raises(HTTPInternalServerError):
view.json(float("NaN"))
assert str(float("NaN")) in caplog.text