Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an xfailing test expecting HTTP500 for invalid handler return values #4574

Merged
merged 1 commit into from
Feb 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/test_web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from yarl import URL

from aiohttp import HttpVersion, web
from aiohttp.client_exceptions import ServerDisconnectedError
from aiohttp.helpers import DEBUG
from aiohttp.http_parser import RawRequestMessage
from aiohttp.streams import StreamReader
Expand Down Expand Up @@ -771,3 +772,19 @@ async def handler(request):
def test_weakref_creation() -> None:
req = make_mocked_request('GET', '/')
weakref.ref(req)


@pytest.mark.xfail(
raises=ServerDisconnectedError,
reason="see https://github.com/aio-libs/aiohttp/issues/4572"
)
async def test_handler_return_type(aiohttp_client) -> None:
async def invalid_handler_1(request):
return 1

app = web.Application()
app.router.add_get('/1', invalid_handler_1)
client = await aiohttp_client(app)

async with client.get('/1') as resp:
assert 500 == resp.status
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also check if the text includes something like "Internal Server Error".