Use http.HTTPStatus in components/[wxyz]* (#58330)

This commit is contained in:
Ville Skyttä 2021-10-24 18:25:01 +03:00 committed by GitHub
parent 1a9bb47f78
commit 0de95610e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 69 additions and 52 deletions

View file

@ -1,5 +1,6 @@
"""Tests for the Withings component."""
import datetime
from http import HTTPStatus
import re
from typing import Any
from unittest.mock import MagicMock
@ -43,7 +44,7 @@ async def test_config_entry_withings_api(hass: HomeAssistant) -> None:
with requests_mock.mock() as rqmck:
rqmck.get(
re.compile(".*"),
status_code=200,
status_code=HTTPStatus.OK,
json={"status": 0, "body": {"message": "success"}},
)
@ -119,7 +120,7 @@ async def test_webhook_head(
client: TestClient = await aiohttp_client(hass.http.app)
resp = await client.head(urlparse(data_manager.webhook_config.url).path)
assert resp.status == 200
assert resp.status == HTTPStatus.OK
async def test_webhook_put(
@ -141,7 +142,7 @@ async def test_webhook_put(
# Wait for remaining tasks to complete.
await hass.async_block_till_done()
assert resp.status == 200
assert resp.status == HTTPStatus.OK
data = await resp.json()
assert data
assert data["code"] == 2
@ -196,7 +197,7 @@ async def test_data_manager_webhook_subscription(
aioclient_mock.request(
"HEAD",
data_manager.webhook_config.url,
status=200,
status=HTTPStatus.OK,
)
# Test subscribing