Use content type json constant (#40312)

This commit is contained in:
springstan 2020-09-23 20:21:55 +02:00 committed by GitHub
parent 9c1eb78a0f
commit 6a7caad8dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 170 additions and 153 deletions

View file

@ -5,6 +5,7 @@ import pytest
from homeassistant.components.cloud import DOMAIN
from homeassistant.components.cloud.client import CloudClient
from homeassistant.components.cloud.const import PREF_ENABLE_ALEXA, PREF_ENABLE_GOOGLE
from homeassistant.const import CONTENT_TYPE_JSON
from homeassistant.core import State
from homeassistant.setup import async_setup_component
@ -175,7 +176,7 @@ async def test_webhook_msg(hass, caplog):
{
"cloudhook_id": "mock-cloud-id",
"body": '{"hello": "world"}',
"headers": {"content-type": "application/json"},
"headers": {"content-type": CONTENT_TYPE_JSON},
"method": "POST",
"query": None,
}
@ -184,7 +185,7 @@ async def test_webhook_msg(hass, caplog):
assert response == {
"status": 200,
"body": '{"from": "handler"}',
"headers": {"Content-Type": "application/json"},
"headers": {"Content-Type": CONTENT_TYPE_JSON},
}
assert len(received) == 1
@ -197,7 +198,7 @@ async def test_webhook_msg(hass, caplog):
{
"cloudhook_id": "mock-nonexisting-id",
"body": '{"nonexisting": "payload"}',
"headers": {"content-type": "application/json"},
"headers": {"content-type": CONTENT_TYPE_JSON},
"method": "POST",
"query": None,
}