First step into unittesting

I still use unittesting (Pyhonts own unittest package) and aiohttp - but not together. :wink:

No I am on the way point where I have to do unittest components of my software which use aiohttp. I read the “Testing” section of the docs. But it is very hard for me to understand because there is no “minimal working example” but just code snippets. For example I can see no def test_() anywhere.

The reactions of my application depends on what it gets back from aiohttp requests (aihottp.ClientSession(header).get(url)). It depends on the raw content and/or on the header (e.g. 404, 303, …).

To test this “reactions” I need to mock(?) define what aiohttp send back as content and has headers.

OK, I found out that I am not able to mocking the aiohttp methods via simple overloading. This has something to do with the async thing I assume.

So I opened a StackOverflow question about the fist unittest example in the official aiohttp docs.

This example talks about a Application class and overloading get_app(). I never heard about that.