Search code examples
pythontestingpython-unittestklein-mvc

How to test Klein server in python


I have made an async http api in Python using Klein. I would like to test my requests using something like Unittest or similar.

I have found this but I'm not sure I'll be able to implement it remotely the same way.

Is there a correct and direct approach to do something similar to what was done in the example I've found?

Thanks in advance


Solution

  • Have a look at the responses or requests-mock python libraries. They both provide great features for testing HTTP requests.