How to disable aiohttp.web applications

Given the aiohttp.web application with views like this:

async def hello(request):
    return web.Response(body=b"Hello, world")

I am trying to figure out how to test them correctly.

I usually use Django as my own test client when writing Django applications and looked for something similar for aiohttp.web. I am not sure if this is the right approach or not.

TL DR: How to simulate a request in an application aiohttp.webin unittest?

+4
source share
1 answer

You can create a web server and execute real HTTP requests without modeling .

. https://github.com/KeepSafe/aiohttp/blob/master/tests/test_client_functional.py, .

+3

Source: https://habr.com/ru/post/1622238/


All Articles