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
@@ -3,7 +3,7 @@
import json
from homeassistant.components.wled.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_MAC
from homeassistant.const import CONF_HOST, CONF_MAC, CONTENT_TYPE_JSON
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry, load_fixture
@@ -24,25 +24,25 @@ async def init_integration(
aioclient_mock.get(
"http://192.168.1.123:80/json/",
json=data,
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
aioclient_mock.post(
"http://192.168.1.123:80/json/state",
json=data["state"],
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
"http://192.168.1.123:80/json/info",
json=data["info"],
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
"http://192.168.1.123:80/json/state",
json=data["state"],
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
entry = MockConfigEntry(
+4 -4
View File
@@ -5,7 +5,7 @@ from wled import WLEDConnectionError
from homeassistant import data_entry_flow
from homeassistant.components.wled import config_flow
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME, CONTENT_TYPE_JSON
from homeassistant.core import HomeAssistant
from . import init_integration
@@ -45,7 +45,7 @@ async def test_show_zerconf_form(
aioclient_mock.get(
"http://192.168.1.123:80/json/",
text=load_fixture("wled/rgb.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
flow = config_flow.WLEDFlowHandler()
@@ -190,7 +190,7 @@ async def test_full_user_flow_implementation(
aioclient_mock.get(
"http://192.168.1.123:80/json/",
text=load_fixture("wled/rgb.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -218,7 +218,7 @@ async def test_full_zeroconf_flow_implementation(
aioclient_mock.get(
"http://192.168.1.123:80/json/",
text=load_fixture("wled/rgb.json"),
headers={"Content-Type": "application/json"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)
flow = config_flow.WLEDFlowHandler()