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

+19 -19
View File
@@ -17,7 +17,7 @@ from homeassistant.components.deconz.const import (
CONF_MASTER_GATEWAY,
DOMAIN,
)
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT, CONTENT_TYPE_JSON
from .test_gateway import API_KEY, BRIDGEID, setup_deconz_integration
@@ -32,7 +32,7 @@ async def test_flow_discovered_bridges(hass, aioclient_mock):
{"id": BRIDGEID, "internalipaddress": "1.2.3.4", "internalport": 80},
{"id": "1234E567890A", "internalipaddress": "5.6.7.8", "internalport": 80},
],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -52,7 +52,7 @@ async def test_flow_discovered_bridges(hass, aioclient_mock):
aioclient_mock.post(
"http://1.2.3.4:80/api",
json=[{"success": {"username": API_KEY}}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_configure(
@@ -73,7 +73,7 @@ async def test_flow_manual_configuration_decision(hass, aioclient_mock):
aioclient_mock.get(
pydeconz.utils.URL_DISCOVER,
json=[{"id": BRIDGEID, "internalipaddress": "1.2.3.4", "internalport": 80}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -98,13 +98,13 @@ async def test_flow_manual_configuration_decision(hass, aioclient_mock):
aioclient_mock.post(
"http://1.2.3.4:80/api",
json=[{"success": {"username": API_KEY}}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
f"http://1.2.3.4:80/api/{API_KEY}/config",
json={"bridgeid": BRIDGEID},
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_configure(
@@ -125,7 +125,7 @@ async def test_flow_manual_configuration(hass, aioclient_mock):
aioclient_mock.get(
pydeconz.utils.URL_DISCOVER,
json=[],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -146,13 +146,13 @@ async def test_flow_manual_configuration(hass, aioclient_mock):
aioclient_mock.post(
"http://1.2.3.4:80/api",
json=[{"success": {"username": API_KEY}}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
f"http://1.2.3.4:80/api/{API_KEY}/config",
json={"bridgeid": BRIDGEID},
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_configure(
@@ -201,7 +201,7 @@ async def test_manual_configuration_update_configuration(hass, aioclient_mock):
aioclient_mock.get(
pydeconz.utils.URL_DISCOVER,
json=[],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -222,13 +222,13 @@ async def test_manual_configuration_update_configuration(hass, aioclient_mock):
aioclient_mock.post(
"http://2.3.4.5:80/api",
json=[{"success": {"username": API_KEY}}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
f"http://2.3.4.5:80/api/{API_KEY}/config",
json={"bridgeid": BRIDGEID},
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_configure(
@@ -247,7 +247,7 @@ async def test_manual_configuration_dont_update_configuration(hass, aioclient_mo
aioclient_mock.get(
pydeconz.utils.URL_DISCOVER,
json=[],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -268,13 +268,13 @@ async def test_manual_configuration_dont_update_configuration(hass, aioclient_mo
aioclient_mock.post(
"http://1.2.3.4:80/api",
json=[{"success": {"username": API_KEY}}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
f"http://1.2.3.4:80/api/{API_KEY}/config",
json={"bridgeid": BRIDGEID},
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_configure(
@@ -290,7 +290,7 @@ async def test_manual_configuration_timeout_get_bridge(hass, aioclient_mock):
aioclient_mock.get(
pydeconz.utils.URL_DISCOVER,
json=[],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -311,7 +311,7 @@ async def test_manual_configuration_timeout_get_bridge(hass, aioclient_mock):
aioclient_mock.post(
"http://1.2.3.4:80/api",
json=[{"success": {"username": API_KEY}}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
@@ -331,7 +331,7 @@ async def test_link_get_api_key_ResponseError(hass, aioclient_mock):
aioclient_mock.get(
pydeconz.utils.URL_DISCOVER,
json=[{"id": BRIDGEID, "internalipaddress": "1.2.3.4", "internalport": 80}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_init(
@@ -374,7 +374,7 @@ async def test_flow_ssdp_discovery(hass, aioclient_mock):
aioclient_mock.post(
"http://1.2.3.4:80/api",
json=[{"success": {"username": API_KEY}}],
headers={"content-type": "application/json"},
headers={"content-type": CONTENT_TYPE_JSON},
)
result = await hass.config_entries.flow.async_configure(