hass-core/tests/components/http/test_view.py
Paulus Schoutsen 0a2e949e0a Remove crazy JSON encoding things that are no longer used (#13029)
Catch JSON encoding errors in HTTP view
2018-03-12 23:22:08 +01:00

15 lines
407 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(object)
assert str(object) in caplog.text