Given an aiohttp.web application with views like this one:
async def hello(request):
return web.Response(body=b"Hello, world")
I'm trying to understand how to properly unit-test them.
I normally use Django's own test client when writing Django apps, and was looking for something similar for aiohttp.web. I'm not sure this is the right approach or not.
TL;DR: How do I simulate a request to an aiohttp.web
app in a unittest?
You may create web server and perform real HTTP requests without simulation.
See https://github.com/KeepSafe/aiohttp/blob/master/tests/test_client_functional.py for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With