Use HTTPStatus instead of HTTP_ consts and magic values in comp.../[de]* (#57990)

This commit is contained in:
Ville Skyttä 2021-10-22 17:28:56 +03:00 committed by GitHub
parent c84fee7c6e
commit 8bc1509afa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 119 additions and 117 deletions

View file

@ -1,4 +1,6 @@
"""The tests for the demo stt component."""
from http import HTTPStatus
import pytest
from homeassistant.components import stt
@ -19,7 +21,7 @@ async def test_demo_settings(hass_client):
response = await client.get("/api/stt/demo")
response_data = await response.json()
assert response.status == 200
assert response.status == HTTPStatus.OK
assert response_data == {
"languages": ["en", "de"],
"bit_rates": [16],
@ -35,7 +37,7 @@ async def test_demo_speech_no_metadata(hass_client):
client = await hass_client()
response = await client.post("/api/stt/demo", data=b"Test")
assert response.status == 400
assert response.status == HTTPStatus.BAD_REQUEST
async def test_demo_speech_wrong_metadata(hass_client):
@ -49,7 +51,7 @@ async def test_demo_speech_wrong_metadata(hass_client):
},
data=b"Test",
)
assert response.status == 415
assert response.status == HTTPStatus.UNSUPPORTED_MEDIA_TYPE
async def test_demo_speech(hass_client):
@ -65,5 +67,5 @@ async def test_demo_speech(hass_client):
)
response_data = await response.json()
assert response.status == 200
assert response.status == HTTPStatus.OK
assert response_data == {"text": "Turn the Kitchen Lights on", "result": "success"}