-
-
Notifications
You must be signed in to change notification settings - Fork 28.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove crazy JSON encoding things that are no longer used (#13029)
Catch JSON encoding errors in HTTP view
- Loading branch information
Showing
4 changed files
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""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 |