Fix cloud webhook body (#20739)

* Bugfix cloud webhooks text response

* address comments

* Fix lint
This commit is contained in:
Pascal Vizeli authored and Paulus Schoutsen committed 2019-02-04 22:01:49 -08:00
1 parent 94ab5dca7f
commit cfa03a408e
5 files changed
+40 -35

No files matched your search

-21
View File
@@ -1,5 +1,4 @@
"""Test aiohttp request helper."""
from aiohttp import web
from homeassistant.util import aiohttp
@@ -32,23 +31,3 @@ async def test_request_post_query():
assert request.query == {
'get': 'true'
}
def test_serialize_text():
"""Test serializing a text response."""
response = web.Response(status=201, text='Hello')
assert aiohttp.serialize_response(response) == {
'status': 201,
'body': b'Hello',
'headers': {'Content-Type': 'text/plain; charset=utf-8'},
}
def test_serialize_json():
"""Test serializing a JSON response."""
response = web.json_response({"how": "what"})
assert aiohttp.serialize_response(response) == {
'status': 200,
'body': b'{"how": "what"}',
'headers': {'Content-Type': 'application/json; charset=utf-8'},
}