mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Use http.HTTPStatus in components/f* (#58244)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Define fixtures available for all tests."""
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
import time
|
||||
|
||||
@@ -41,40 +42,40 @@ def aioclient_mock_fixture(aioclient_mock):
|
||||
}
|
||||
),
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
)
|
||||
# Mocks the devices for flo.
|
||||
aioclient_mock.get(
|
||||
"https://api-gw.meetflo.com/api/v2/devices/98765",
|
||||
text=load_fixture("flo/device_info_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
aioclient_mock.get(
|
||||
"https://api-gw.meetflo.com/api/v2/devices/32839",
|
||||
text=load_fixture("flo/device_info_response_detector.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
# Mocks the water consumption for flo.
|
||||
aioclient_mock.get(
|
||||
"https://api-gw.meetflo.com/api/v2/water/consumption",
|
||||
text=load_fixture("flo/water_consumption_info_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
# Mocks the location info for flo.
|
||||
aioclient_mock.get(
|
||||
"https://api-gw.meetflo.com/api/v2/locations/mmnnoopp",
|
||||
text=load_fixture("flo/location_info_expand_devices_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
# Mocks the user info for flo.
|
||||
aioclient_mock.get(
|
||||
"https://api-gw.meetflo.com/api/v2/users/12345abcde",
|
||||
text=load_fixture("flo/user_info_expand_locations_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
params={"expand": "locations"},
|
||||
)
|
||||
@@ -82,14 +83,14 @@ def aioclient_mock_fixture(aioclient_mock):
|
||||
aioclient_mock.get(
|
||||
"https://api-gw.meetflo.com/api/v2/users/12345abcde",
|
||||
text=load_fixture("flo/user_info_expand_locations_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
# Mocks the valve open call for flo.
|
||||
aioclient_mock.post(
|
||||
"https://api-gw.meetflo.com/api/v2/devices/98765",
|
||||
text=load_fixture("flo/device_info_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
json={"valve": {"target": "open"}},
|
||||
)
|
||||
@@ -97,7 +98,7 @@ def aioclient_mock_fixture(aioclient_mock):
|
||||
aioclient_mock.post(
|
||||
"https://api-gw.meetflo.com/api/v2/devices/98765",
|
||||
text=load_fixture("flo/device_info_response_closed.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
json={"valve": {"target": "closed"}},
|
||||
)
|
||||
@@ -105,14 +106,14 @@ def aioclient_mock_fixture(aioclient_mock):
|
||||
aioclient_mock.post(
|
||||
"https://api-gw.meetflo.com/api/v2/devices/98765/healthTest/run",
|
||||
text=load_fixture("flo/user_info_expand_locations_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
# Mocks the health test call for flo.
|
||||
aioclient_mock.post(
|
||||
"https://api-gw.meetflo.com/api/v2/locations/mmnnoopp/systemMode",
|
||||
text=load_fixture("flo/user_info_expand_locations_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
json={"systemMode": {"target": "home"}},
|
||||
)
|
||||
@@ -120,7 +121,7 @@ def aioclient_mock_fixture(aioclient_mock):
|
||||
aioclient_mock.post(
|
||||
"https://api-gw.meetflo.com/api/v2/locations/mmnnoopp/systemMode",
|
||||
text=load_fixture("flo/user_info_expand_locations_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
json={"systemMode": {"target": "away"}},
|
||||
)
|
||||
@@ -128,7 +129,7 @@ def aioclient_mock_fixture(aioclient_mock):
|
||||
aioclient_mock.post(
|
||||
"https://api-gw.meetflo.com/api/v2/locations/mmnnoopp/systemMode",
|
||||
text=load_fixture("flo/user_info_expand_locations_response.json"),
|
||||
status=200,
|
||||
status=HTTPStatus.OK,
|
||||
headers={"Content-Type": CONTENT_TYPE_JSON},
|
||||
json={
|
||||
"systemMode": {
|
||||
|
||||
Reference in New Issue
Block a user