mirror of
https://github.com/home-assistant/core.git
synced 2025-12-25 05:26:47 +00:00
Revert aiohttp to 3.8.5 for Python 3.11 (#101932)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
"""Test aiohttp request helper."""
|
||||
import sys
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from homeassistant.util import aiohttp
|
||||
@@ -48,11 +50,22 @@ def test_serialize_text() -> None:
|
||||
def test_serialize_body_str() -> None:
|
||||
"""Test serializing a response with a str as body."""
|
||||
response = web.Response(status=201, body="Hello")
|
||||
assert aiohttp.serialize_response(response) == {
|
||||
"status": 201,
|
||||
"body": "Hello",
|
||||
"headers": {"Content-Type": "text/plain; charset=utf-8"},
|
||||
}
|
||||
# TODO: Remove version check with aiohttp 3.9.0
|
||||
if sys.version_info >= (3, 12):
|
||||
assert aiohttp.serialize_response(response) == {
|
||||
"status": 201,
|
||||
"body": "Hello",
|
||||
"headers": {"Content-Type": "text/plain; charset=utf-8"},
|
||||
}
|
||||
else:
|
||||
assert aiohttp.serialize_response(response) == {
|
||||
"status": 201,
|
||||
"body": "Hello",
|
||||
"headers": {
|
||||
"Content-Length": "5",
|
||||
"Content-Type": "text/plain; charset=utf-8",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_serialize_body_None() -> None:
|
||||
|
||||
Reference in New Issue
Block a user