Use content type json constant (#40312)

This commit is contained in:
springstan authored and GitHub committed 2020-09-23 20:21:55 +02:00
1 parent 9c1eb78a0f
commit 6a7caad8dc
28 files changed
+170 -153

No files matched your search

+5 -5
View File
@@ -1,7 +1,7 @@
"""Tests for the Elgato Key Light integration."""
from homeassistant.components.elgato.const import CONF_SERIAL_NUMBER, DOMAIN
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.const import CONF_HOST, CONF_PORT, CONTENT_TYPE_JSON
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry, load_fixture
@@ -18,25 +18,25 @@ async def init_integration(
aioclient_mock.get(
"http://1.2.3.4:9123/elgato/accessory-info",
text=load_fixture("elgato/info.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
aioclient_mock.put(
"http://1.2.3.4:9123/elgato/lights",
text=load_fixture("elgato/state.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
"http://1.2.3.4:9123/elgato/lights",
text=load_fixture("elgato/state.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
"http://5.6.7.8:9123/elgato/accessory-info",
text=load_fixture("elgato/info.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
entry = MockConfigEntry(
+4 -4
View File
@@ -5,7 +5,7 @@ from homeassistant import data_entry_flow
from homeassistant.components.elgato import config_flow
from homeassistant.components.elgato.const import CONF_SERIAL_NUMBER
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.const import CONF_HOST, CONF_PORT, CONTENT_TYPE_JSON
from homeassistant.core import HomeAssistant
from . import init_integration
@@ -44,7 +44,7 @@ async def test_show_zerconf_form(
aioclient_mock.get(
"http://1.2.3.4:9123/elgato/accessory-info",
text=load_fixture("elgato/info.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
flow = config_flow.ElgatoFlowHandler()
@@ -176,7 +176,7 @@ async def test_full_user_flow_implementation(
aioclient_mock.get(
"http://1.2.3.4:9123/elgato/accessory-info",
text=load_fixture("elgato/info.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -208,7 +208,7 @@ async def test_full_zeroconf_flow_implementation(
aioclient_mock.get(
"http://1.2.3.4:9123/elgato/accessory-info",
text=load_fixture("elgato/info.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
flow = config_flow.ElgatoFlowHandler()